From e88942c9a997b50828fa13ac0a10616b1bf022eb Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 26 Dec 2020 21:09:14 +0100 Subject: [PATCH] Reduce the NACK delay. We bound the NACK delay to 2 packets, which is what TCP does. Thus, reducing the delay should be safe. --- rtpconn/rtpreader.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rtpconn/rtpreader.go b/rtpconn/rtpreader.go index e767b43..24fe72a 100644 --- a/rtpconn/rtpreader.go +++ b/rtpconn/rtpreader.go @@ -167,9 +167,10 @@ func readLoop(conn *rtpUpConnection, track *rtpUpTrack) { if (delta & 0x8000) != 0 { delta = 0 } - // send a NACK if a packet is late by 65ms or 2 packets, - // whichever is more - packets := rate / 16 + // send a NACK if a packet is late by 20ms or 2 packets, + // whichever is more. Since TCP sends a dupack after 2 packets, + // this should be safe. + packets := rate / 50 if packets > 24 { packets = 24 }