mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2026-01-27 12:50:49 +03:00
Merge remote-tracking branch 'origin/master' into httpd
Conflicts: components/wifi-manager/http_server.c
This commit is contained in:
@@ -542,7 +542,7 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
|
||||
|
||||
if ((p = strcasestr(buf, "timing_port")) != NULL) sscanf(p, "%*[^=]=%hu", &tport);
|
||||
if ((p = strcasestr(buf, "control_port")) != NULL) sscanf(p, "%*[^=]=%hu", &cport);
|
||||
|
||||
|
||||
rtp = rtp_init(ctx->peer, ctx->latency, ctx->rtsp.aeskey, ctx->rtsp.aesiv,
|
||||
ctx->rtsp.fmtp, cport, tport, ctx->cmd_cb, ctx->data_cb);
|
||||
|
||||
@@ -630,9 +630,10 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
|
||||
float volume;
|
||||
|
||||
sscanf(p, "%*[^:]:%f", &volume);
|
||||
LOG_INFO("[%p]: SET PARAMETER volume %f", ctx, volume);
|
||||
volume = (volume == -144.0) ? 0 : (1 + volume / 30);
|
||||
volume = (volume == -144.0) ? 0 : (1 + volume / 30);
|
||||
success = ctx->cmd_cb(RAOP_VOLUME, volume);
|
||||
success = ctx->cmd_cb(RAOP_VOLUME, volume);
|
||||
} else if (body && (p = strcasestr(body, "progress")) != NULL) {
|
||||
int start, current, stop = 0;
|
||||
|
||||
// we want ms, not s
|
||||
|
||||
@@ -564,7 +564,7 @@ static void *rtp_thread_func(void *arg) {
|
||||
bool ntp_sent;
|
||||
char *packet = malloc(MAX_PACKET);
|
||||
rtp_t *ctx = (rtp_t*) arg;
|
||||
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (ctx->rtp_sockets[i].sock > sock) sock = ctx->rtp_sockets[i].sock;
|
||||
// send synchro request 3 times
|
||||
@@ -638,7 +638,9 @@ static void *rtp_thread_func(void *arg) {
|
||||
u32_t rtp_now_latency = ntohl(*(u32_t*)(pktp+4));
|
||||
u64_t remote = (((u64_t) ntohl(*(u32_t*)(pktp+8))) << 32) + ntohl(*(u32_t*)(pktp+12));
|
||||
u32_t rtp_now = ntohl(*(u32_t*)(pktp+16));
|
||||
u16_t flags = ntohs(*(u16_t*)(pktp+2));
|
||||
u32_t remote_gap = NTP2MS(remote - ctx->timing.remote);
|
||||
|
||||
// something is wrong and if we are supposed to be NTP synced, better ask for re-sync
|
||||
if (remote_gap > 10000) {
|
||||
if (ctx->synchro.status & NTP_SYNC) rtp_request_timing(ctx);
|
||||
@@ -683,8 +685,9 @@ static void *rtp_thread_func(void *arg) {
|
||||
case 0x53: {
|
||||
u64_t expected;
|
||||
u32_t reference = ntohl(*(u32_t*)(pktp+12)); // only low 32 bits in our case
|
||||
u64_t remote =(((u64_t) ntohl(*(u32_t*)(pktp+16))) << 32) + ntohl(*(u32_t*)(pktp+20));
|
||||
u64_t remote =(((u64_t) ntohl(*(u32_t*)(pktp+16))) << 32) + ntohl(*(u32_t*)(pktp+20));
|
||||
u32_t roundtrip = gettime_ms() - reference;
|
||||
|
||||
// better discard sync packets when roundtrip is suspicious and ask for another one
|
||||
if (roundtrip > 100) {
|
||||
rtp_request_timing(ctx);
|
||||
|
||||
Reference in New Issue
Block a user