From f5ae5df5d0689084293dbce3c20a6ff2322c9c2c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 1 Dec 2019 19:22:16 -0800 Subject: [PATCH] Fix logic error in low bitrate audio duration selection --- src/SdpGenerator.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/SdpGenerator.c b/src/SdpGenerator.c index 78eeb0a..b04a34b 100644 --- a/src/SdpGenerator.c +++ b/src/SdpGenerator.c @@ -379,13 +379,14 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) { if ((AudioCallbacks.capabilities & CAPABILITY_SLOW_OPUS_DECODER) != 0 || ((AudioCallbacks.capabilities & CAPABILITY_SUPPORTS_ARBITRARY_AUDIO_DURATION) != 0 && - OriginalVideoBitrate >= LOW_AUDIO_BITRATE_TRESHOLD)) { - // Use 5 ms packets by default for lowest latency - AudioPacketDuration = 5; + OriginalVideoBitrate < LOW_AUDIO_BITRATE_TRESHOLD)) { + // Use 20 ms packets for slow decoders and networks to save CPU and bandwidth + AudioPacketDuration = 20; } else { - // Use 20 ms packets for slow decoders to save CPU and bandwidth - AudioPacketDuration = 20; + + // Use 5 ms packets by default for lowest latency + AudioPacketDuration = 5; } }