From 2ed3db46eb8ae406316097faf6791f212161caef Mon Sep 17 00:00:00 2001 From: Daniel Stiner Date: Sun, 28 Mar 2021 13:27:03 -0700 Subject: [PATCH] Reduce traffic smoothing window size Now that we correctly use the peak bitrate for traffic smoothing, we need to be more careful to not exceed that bitrate. This reduces our max burst size significantly to achieve that. For frames larger than would have fit in the 100ms burst window this change does not significantly change behavior except instead of sending an initial burst and then trickling out packets we now send a tiny burst that is 1/10th the size and then trickle. The overall send time for the frame should remain the same. For frames small enough to fit in the 100ms burst window but too large to fit in a 10ms burst window this change does impact behavior, the send will be smoothed out and the frame may take a few extra milliseconds to send. In the worst case, instead of a frame being sent in one big burst at the start of the 100ms burst window, it will now be smoothed out over 100ms. This new behavior seems to perform better in all situations. If you have a fast connection your peak kbps will be much higher than the video kbps and only minimal smoothing will be applied. If you are streaming at close to the speed of your connection then significant smoothing will be applied to keep within your network's capability. Doing this smoothing at the application level is preferred with RTP over trusting the user's router and connection to handle large bursts of packets. --- libftl/ftl_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libftl/ftl_private.h b/libftl/ftl_private.h index 93260ed..94d1db9 100644 --- a/libftl/ftl_private.h +++ b/libftl/ftl_private.h @@ -69,7 +69,7 @@ #define NACK_RTT_AVG_SECONDS 5 #define MAX_STATUS_MESSAGE_QUEUED 10 #define MAX_FRAME_SIZE_ELEMENTS 64 //must be a minimum of 3 -#define MAX_XMIT_LEVEL_IN_MS 100 //allows a maximum burst size of 100ms at the target bitrate +#define MAX_XMIT_LEVEL_IN_MS 10 // allows a maximum burst size of 10ms at the peak bitrate #define VIDEO_RTP_TS_CLOCK_HZ 90000 #define AUDIO_SAMPLE_RATE 48000 #define AUDIO_PACKET_DURATION_MS 20