From eff97414bf54b83d0d3599017c1b02f0751d5b3f Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 19 Jun 2021 16:44:48 -0500 Subject: [PATCH] Perform the initial audio resync even if we hit the polling timeout --- src/AudioStream.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/AudioStream.c b/src/AudioStream.c index 2042898..946fdab 100644 --- a/src/AudioStream.c +++ b/src/AudioStream.c @@ -268,10 +268,11 @@ static void ReceiveThreadProc(void* context) { if (!receivedDataFromPeer) { waitingForAudioMs += UDP_RECV_POLL_TIMEOUT_MS; } - - // If we hit this path, there are no queued audio packets on the host PC, - // so we don't need to drop anything. - packetsToDrop = 0; + else { + // If we hit this path, there are no queued audio packets on the host PC, + // so we don't need to drop anything. + packetsToDrop = 0; + } continue; } @@ -288,8 +289,9 @@ static void ReceiveThreadProc(void* context) { if (firstReceiveTime != 0) { packetsToDrop += (uint32_t)(PltGetMillis() - firstReceiveTime) / AudioPacketDuration; - Limelog("Initial audio resync period: %d milliseconds\n", packetsToDrop * AudioPacketDuration); } + + Limelog("Initial audio resync period: %d milliseconds\n", packetsToDrop * AudioPacketDuration); } // GFE accumulates audio samples before we are ready to receive them, so