From 31b06e52ea988a933a1c40b6c2d4959a7b1e65fb 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 1955ecf1..84269ce0 100644 --- a/net/rtp/src/gcc/imp.rs +++ b/net/rtp/src/gcc/imp.rs @@ -1190,11 +1190,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 {