tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e401f4eac294d11b6d3947180615067765e02753
parent e46d0861f906b7871d68735a0a2bf2017b234dd0
Author: Michael Froman <mfroman@mozilla.com>
Date:   Wed,  8 Oct 2025 17:01:40 -0500

Bug 1993083 - Vendor libwebrtc from 4f422cb71c

Upstream commit: https://webrtc.googlesource.com/src/+/4f422cb71cf3de656d16fd79b791414813ef9c8e
    Fix loss based BWE to avoid unnecessary paddings.

    When the delay-based estimate and a 2% bandwidth-increase candidate had the same kbps but different bps, the algorithm selected the latter.
    This resulted in a lower bandwidth selection than the delay-based estimate, triggering unnecessary padding.

    With this change, the higher bandwidth candidate will be selected if having the same kbps.

    Bug: webrtc:12707,webrtc:427648364
    Change-Id: I1ed042689317c768b773d7e6f0819690c38f0e56
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/398080
    Commit-Queue: Diep Bui <diepbp@webrtc.org>
    Reviewed-by: Per Kjellander <perkj@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45027}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc | 7++++++-
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc | 25+++++++++++++++++++++++++
3 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-08T22:00:29.428940+00:00. +libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-08T22:01:33.102578+00:00. # base of lastest vendoring -43f724dcac +4f422cb71c diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc @@ -224,7 +224,12 @@ void LossBasedBweV2::UpdateBandwidthEstimate( NewtonsMethodUpdate(candidate); const double candidate_objective = GetObjective(candidate); - if (candidate_objective > objective_max) { + if (candidate_objective > objective_max || + (candidate_objective == objective_max && + candidate.loss_limited_bandwidth > + best_candidate.loss_limited_bandwidth)) { + // Select the candidate with the highest objective or the one with the + // same objective but higher bandwidth if they are tied. objective_max = candidate_objective; best_candidate = candidate; } diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2_test.cc @@ -1793,5 +1793,30 @@ TEST_F(LossBasedBweV2Test, kStartBitrate); } +TEST_F(LossBasedBweV2Test, SelectHigherCandidateIfHavingSameObjective) { + FieldTrials key_value_config = ShortObservationConfig(""); + LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config); + const DataRate kStartBitrate = DataRate::KilobitsPerSec(1000); + loss_based_bandwidth_estimator.SetBandwidthEstimate(kStartBitrate); + std::vector<PacketResult> enough_feedback_01 = + CreatePacketResultsWithReceivedPackets( + /*first_packet_timestamp=*/Timestamp::Zero()); + std::vector<PacketResult> enough_feedback_02 = + CreatePacketResultsWithReceivedPackets( + /*first_packet_timestamp=*/Timestamp::Zero() + + kObservationDurationLowerBound); + loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_01, + kStartBitrate, + /*in_alr=*/false); + DataRate delay_based_estimate = + DataRate::BytesPerSec(kStartBitrate.bytes_per_sec() * 1.02 + 1); + loss_based_bandwidth_estimator.UpdateBandwidthEstimate(enough_feedback_02, + delay_based_estimate, + /*in_alr=*/false); + + EXPECT_EQ( + loss_based_bandwidth_estimator.GetLossBasedResult().bandwidth_estimate, + delay_based_estimate); +} } // namespace } // namespace webrtc