From 60ae3fc0b9132e68eeac1d9cb8571dc2c232b4b2 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 14 Apr 2023 10:42:51 +0200 Subject: [PATCH] rtpgccbwe: Improve packet handling Both the delay-based *and* loss-based estimates should be computed instead of just one. This ensures faster adaptation. Part-of: --- net/rtp/src/gcc/imp.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/rtp/src/gcc/imp.rs b/net/rtp/src/gcc/imp.rs index 0d649db6..3bdb079e 100644 --- a/net/rtp/src/gcc/imp.rs +++ b/net/rtp/src/gcc/imp.rs @@ -1200,11 +1200,9 @@ impl ObjectSubclass for BandwidthEstimator { let mut state = this.state.lock().unwrap(); state.detector.update(&mut packets); - if !state.delay_control(&bwe) { - state.loss_control(&bwe) - } else { - true - } + let bitrate_updated_by_delay = state.delay_control(&bwe); + let bitrate_updated_by_loss = state.loss_control(&bwe); + bitrate_updated_by_delay || bitrate_updated_by_loss }; if bitrate_changed {