mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 20:17:04 +03:00
continue the AirPlay saga - release
This commit is contained in:
@@ -654,7 +654,7 @@ static void *rtp_thread_func(void *arg) {
|
|||||||
u64_t remote = (((u64_t) ntohl(*(u32_t*)(pktp+8))) << 32) + ntohl(*(u32_t*)(pktp+12));
|
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));
|
u32_t rtp_now = ntohl(*(u32_t*)(pktp+16));
|
||||||
u16_t flags = ntohs(*(u16_t*)(pktp+2));
|
u16_t flags = ntohs(*(u16_t*)(pktp+2));
|
||||||
u32_t remote_gap = NTP2MS(remote - ctx->timing.remote);
|
u32_t remote_gap = NTP2MS(remote - ctx->timing.remote);
|
||||||
|
|
||||||
// try to get NTP every 3 sec or every time if we are not synced
|
// try to get NTP every 3 sec or every time if we are not synced
|
||||||
if (!count-- || !(ctx->synchro.status & NTP_SYNC)) {
|
if (!count-- || !(ctx->synchro.status & NTP_SYNC)) {
|
||||||
@@ -700,9 +700,10 @@ static void *rtp_thread_func(void *arg) {
|
|||||||
case 0x53: {
|
case 0x53: {
|
||||||
u64_t expected;
|
u64_t expected;
|
||||||
u32_t reference = ntohl(*(u32_t*)(pktp+12)); // only low 32 bits in our case
|
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;
|
u32_t roundtrip = gettime_ms() - reference;
|
||||||
|
|
||||||
|
// better discard sync packets when roundtrip is suspicious
|
||||||
if (roundtrip > 100) {
|
if (roundtrip > 100) {
|
||||||
// ask for another one only if we are not synced already
|
// ask for another one only if we are not synced already
|
||||||
if (!(ctx->synchro.status & NTP_SYNC) rtp_request_timing(ctx);
|
if (!(ctx->synchro.status & NTP_SYNC) rtp_request_timing(ctx);
|
||||||
|
|||||||
Reference in New Issue
Block a user