tor-browser

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

commit 9dd570f8be2eda1a611aa1874b102da053525309
parent d498f0667b928db1f58c7fbffe646cf55b161ff8
Author: Michael Froman <mfroman@mozilla.com>
Date:   Wed,  8 Oct 2025 16:00:44 -0500

Bug 1993083 - Vendor libwebrtc from 0cc5aae57a

Upstream commit: https://webrtc.googlesource.com/src/+/0cc5aae57a6e0c5dc544406d03d38b374f879bfb
    Deprecate TargetTransferRate.stable_target_rate from GoogCC

    It is no longer used in WebRTC.
    The cl removes LinkCapacityTracker which is used for calculating TargetTransferRate.stable_target_rate.
    TargetTransferRate.stable_target_rate is temporary set to TargetTransferRate.target_rate in order to not break public API.

    Bug: webrtc:423841921
    Change-Id: I920ddcfc7411540c79e3eb4a26f5f23ce658b434
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/397120
    Reviewed-by: Diep Bui <diepbp@webrtc.org>
    Commit-Queue: Per Kjellander <perkj@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45005}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/api/transport/network_types.h | 4+++-
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc | 15+++++----------
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.h | 1-
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc | 38--------------------------------------
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc | 52----------------------------------------------------
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h | 22----------------------
Mthird_party/libwebrtc/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc | 1-
Mthird_party/libwebrtc/test/scenario/call_client.cc | 5-----
Mthird_party/libwebrtc/test/scenario/call_client.h | 1-
10 files changed, 10 insertions(+), 133 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-08T20:59:14.244732+00:00. +libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-08T21:00:34.183713+00:00. # base of lastest vendoring -fe0a0c784e +0cc5aae57a diff --git a/third_party/libwebrtc/api/transport/network_types.h b/third_party/libwebrtc/api/transport/network_types.h @@ -240,7 +240,9 @@ struct RTC_EXPORT TargetTransferRate { // The estimate on which the target rate is based on. NetworkEstimate network_estimate; DataRate target_rate = DataRate::Zero(); - DataRate stable_target_rate = DataRate::Zero(); + // TODO(bugs.webrtc.org/423841921): stable_rate is not used by WebRTC and + // should be removed as soon as downstream projects are not referencing it. + DataRate stable_target_rate; // Deprecated double cwnd_reduce_ratio = 0; }; diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.cc @@ -128,7 +128,6 @@ GoogCcNetworkController::GoogCcNetworkController(NetworkControllerConfig config, initial_config_(config), last_loss_based_target_rate_(*config.constraints.starting_rate), last_pushback_target_rate_(last_loss_based_target_rate_), - last_stable_target_rate_(last_loss_based_target_rate_), last_loss_base_state_(LossBasedState::kDelayBasedEstimate), pacing_factor_(config.stream_based_config.pacing_factor.value_or( kDefaultPaceMultiplier)), @@ -578,8 +577,6 @@ NetworkControlUpdate GoogCcNetworkController::GetNetworkState( update.target_rate->at_time = at_time; update.target_rate->target_rate = last_pushback_target_rate_; - update.target_rate->stable_target_rate = - bandwidth_estimation_->GetEstimatedLinkCapacity(); update.pacer_config = GetPacingRates(at_time); update.congestion_window = current_data_window_; return update; @@ -608,21 +605,16 @@ void GoogCcNetworkController::MaybeTriggerOnNetworkChanged( loss_based_target_rate.bps(); } } - DataRate stable_target_rate = - bandwidth_estimation_->GetEstimatedLinkCapacity(); - stable_target_rate = std::min(stable_target_rate, pushback_target_rate); if ((loss_based_target_rate != last_loss_based_target_rate_) || (loss_based_state != last_loss_base_state_) || (fraction_loss != last_estimated_fraction_loss_) || (round_trip_time != last_estimated_round_trip_time_) || - (pushback_target_rate != last_pushback_target_rate_) || - (stable_target_rate != last_stable_target_rate_)) { + (pushback_target_rate != last_pushback_target_rate_)) { last_loss_based_target_rate_ = loss_based_target_rate; last_pushback_target_rate_ = pushback_target_rate; last_estimated_fraction_loss_ = fraction_loss; last_estimated_round_trip_time_ = round_trip_time; - last_stable_target_rate_ = stable_target_rate; last_loss_base_state_ = loss_based_state; alr_detector_->SetEstimatedBitrate(loss_based_target_rate.bps()); @@ -637,7 +629,10 @@ void GoogCcNetworkController::MaybeTriggerOnNetworkChanged( } else { target_rate_msg.target_rate = pushback_target_rate; } - target_rate_msg.stable_target_rate = stable_target_rate; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + target_rate_msg.stable_target_rate = loss_based_target_rate; +#pragma clang diagnostic pop target_rate_msg.network_estimate.at_time = at_time; target_rate_msg.network_estimate.round_trip_time = round_trip_time; target_rate_msg.network_estimate.loss_rate_ratio = fraction_loss / 255.0f; diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.h b/third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control.h @@ -121,7 +121,6 @@ class GoogCcNetworkController : public NetworkControllerInterface { DataRate last_loss_based_target_rate_; DataRate last_pushback_target_rate_; - DataRate last_stable_target_rate_; LossBasedState last_loss_base_state_; std::optional<uint8_t> last_estimated_fraction_loss_ = 0; diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc @@ -8,7 +8,6 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include <algorithm> #include <cstddef> #include <cstdint> #include <memory> @@ -590,43 +589,6 @@ TEST(GoogCcScenario, UpdatesTargetRateBasedOnLinkCapacity) { UpdatesTargetRateBasedOnLinkCapacity(); } -TEST(GoogCcScenario, StableEstimateDoesNotVaryInSteadyState) { - GoogCcNetworkControllerFactory factory; - Scenario s("googcc_unit/stable_target", false); - CallClientConfig config; - config.transport.cc_factory = &factory; - NetworkSimulationConfig net_conf; - net_conf.bandwidth = DataRate::KilobitsPerSec(500); - net_conf.delay = TimeDelta::Millis(100); - auto send_net = s.CreateSimulationNode(net_conf); - auto ret_net = s.CreateSimulationNode(net_conf); - - auto* client = CreateVideoSendingClient(&s, config, {send_net}, {ret_net}); - // Run for a while to allow the estimate to stabilize. - s.RunFor(TimeDelta::Seconds(30)); - DataRate min_stable_target = DataRate::PlusInfinity(); - DataRate max_stable_target = DataRate::MinusInfinity(); - DataRate min_target = DataRate::PlusInfinity(); - DataRate max_target = DataRate::MinusInfinity(); - - // Measure variation in steady state. - for (int i = 0; i < 20; ++i) { - auto stable_target_rate = client->stable_target_rate(); - auto target_rate = client->target_rate(); - EXPECT_LE(stable_target_rate, target_rate); - - min_stable_target = std::min(min_stable_target, stable_target_rate); - max_stable_target = std::max(max_stable_target, stable_target_rate); - min_target = std::min(min_target, target_rate); - max_target = std::max(max_target, target_rate); - s.RunFor(TimeDelta::Seconds(1)); - } - // We should expect drops by at least 15% (default backoff.) - EXPECT_LT(min_target / max_target, 0.85); - // We should expect the stable target to be more stable than the immediate one - EXPECT_GE(min_stable_target / max_stable_target, min_target / max_target); -} - TEST(GoogCcScenario, LossBasedControlDoesModestBackoffToHighLoss) { Scenario s("googcc_unit/high_loss_channel", false); CallClientConfig config; diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc @@ -11,7 +11,6 @@ #include "modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h" #include <algorithm> -#include <cmath> #include <cstdint> #include <cstdio> #include <limits> @@ -109,49 +108,6 @@ bool ReadBweLossExperimentParameters(const FieldTrialsView& field_trials, } } // namespace -void LinkCapacityTracker::UpdateDelayBasedEstimate( - Timestamp at_time, - DataRate delay_based_bitrate) { - if (delay_based_bitrate < last_delay_based_estimate_) { - capacity_estimate_bps_ = - std::min(capacity_estimate_bps_, delay_based_bitrate.bps<double>()); - last_link_capacity_update_ = at_time; - } - last_delay_based_estimate_ = delay_based_bitrate; -} - -void LinkCapacityTracker::OnStartingRate(DataRate start_rate) { - if (last_link_capacity_update_.IsInfinite()) - capacity_estimate_bps_ = start_rate.bps<double>(); -} - -void LinkCapacityTracker::OnRateUpdate(std::optional<DataRate> acknowledged, - DataRate target, - Timestamp at_time) { - if (!acknowledged) - return; - DataRate acknowledged_target = std::min(*acknowledged, target); - if (acknowledged_target.bps() > capacity_estimate_bps_) { - TimeDelta delta = at_time - last_link_capacity_update_; - double alpha = - delta.IsFinite() ? exp(-(delta / TimeDelta::Seconds(10))) : 0; - capacity_estimate_bps_ = alpha * capacity_estimate_bps_ + - (1 - alpha) * acknowledged_target.bps<double>(); - } - last_link_capacity_update_ = at_time; -} - -void LinkCapacityTracker::OnRttBackoff(DataRate backoff_rate, - Timestamp at_time) { - capacity_estimate_bps_ = - std::min(capacity_estimate_bps_, backoff_rate.bps<double>()); - last_link_capacity_update_ = at_time; -} - -DataRate LinkCapacityTracker::estimate() const { - return DataRate::BitsPerSec(capacity_estimate_bps_); -} - RttBasedBackoff::RttBasedBackoff(const FieldTrialsView& key_value_config) : disabled_("Disabled"), configured_limit_("limit", TimeDelta::Seconds(3)), @@ -284,7 +240,6 @@ void SendSideBandwidthEstimation::SetBitrates( Timestamp at_time) { SetMinMaxBitrate(min_bitrate, max_bitrate); if (send_bitrate) { - link_capacity_.OnStartingRate(*send_bitrate); SetSendBitrate(*send_bitrate, at_time); } } @@ -332,10 +287,6 @@ bool SendSideBandwidthEstimation::IsRttAboveLimit() const { return rtt_backoff_.IsRttAboveLimit(); } -DataRate SendSideBandwidthEstimation::GetEstimatedLinkCapacity() const { - return link_capacity_.estimate(); -} - void SendSideBandwidthEstimation::UpdateReceiverEstimate(Timestamp at_time, DataRate bandwidth) { // TODO(srte): Ensure caller passes PlusInfinity, not zero, to represent no @@ -346,7 +297,6 @@ void SendSideBandwidthEstimation::UpdateReceiverEstimate(Timestamp at_time, void SendSideBandwidthEstimation::UpdateDelayBasedEstimate(Timestamp at_time, DataRate bitrate) { - link_capacity_.UpdateDelayBasedEstimate(at_time, bitrate); // TODO(srte): Ensure caller passes PlusInfinity, not zero, to represent no // limitation. delay_based_limit_ = bitrate.IsZero() ? DataRate::PlusInfinity() : bitrate; @@ -466,7 +416,6 @@ void SendSideBandwidthEstimation::UpdateEstimate(Timestamp at_time) { DataRate new_bitrate = std::max(current_target_ * rtt_backoff_.drop_fraction_, rtt_backoff_.bandwidth_floor_.Get()); - link_capacity_.OnRttBackoff(new_bitrate, at_time); UpdateTargetBitrate(new_bitrate, at_time); return; } @@ -641,7 +590,6 @@ void SendSideBandwidthEstimation::UpdateTargetBitrate(DataRate new_bitrate, } current_target_ = new_bitrate; MaybeLogLossBasedEvent(at_time); - link_capacity_.OnRateUpdate(acknowledged_rate_, current_target_, at_time); } void SendSideBandwidthEstimation::ApplyTargetLimits(Timestamp at_time) { diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h b/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h @@ -34,26 +34,6 @@ namespace webrtc { class RtcEventLog; -class LinkCapacityTracker { - public: - LinkCapacityTracker() = default; - ~LinkCapacityTracker() = default; - // Call when a new delay-based estimate is available. - void UpdateDelayBasedEstimate(Timestamp at_time, - DataRate delay_based_bitrate); - void OnStartingRate(DataRate start_rate); - void OnRateUpdate(std::optional<DataRate> acknowledged, - DataRate target, - Timestamp at_time); - void OnRttBackoff(DataRate backoff_rate, Timestamp at_time); - DataRate estimate() const; - - private: - double capacity_estimate_bps_ = 0; - Timestamp last_link_capacity_update_ = Timestamp::MinusInfinity(); - DataRate last_delay_based_estimate_ = DataRate::PlusInfinity(); -}; - class RttBasedBackoff { public: explicit RttBasedBackoff(const FieldTrialsView& key_value_config); @@ -94,7 +74,6 @@ class SendSideBandwidthEstimation { uint8_t fraction_loss() const { return last_fraction_loss_; } TimeDelta round_trip_time() const { return last_round_trip_time_; } - DataRate GetEstimatedLinkCapacity() const; // Call periodically to update estimate. void UpdateEstimate(Timestamp at_time); void OnSentPacket(const SentPacket& sent_packet); @@ -165,7 +144,6 @@ class SendSideBandwidthEstimation { const FieldTrialsView* key_value_config_; RttBasedBackoff rtt_backoff_; - LinkCapacityTracker link_capacity_; std::deque<std::pair<Timestamp, DataRate> > min_bitrate_history_; diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc @@ -103,7 +103,6 @@ std::deque<FieldLogger*> GoogCcStatePrinter::CreateLoggers() { Log("time", [this] { return target_.at_time; }), Log("rtt", [this] { return target_.network_estimate.round_trip_time; }), Log("target", [this] { return target_.target_rate; }), - Log("stable_target", [this] { return target_.stable_target_rate; }), Log("pacing", [this] { return pacing_.data_rate(); }), Log("padding", [this] { return pacing_.pad_rate(); }), Log("window", [this] { return congestion_window_; }), diff --git a/third_party/libwebrtc/test/scenario/call_client.cc b/third_party/libwebrtc/test/scenario/call_client.cc @@ -291,11 +291,6 @@ DataRate CallClient::target_rate() const { return network_controller_factory_.GetUpdate().target_rate->target_rate; } -DataRate CallClient::stable_target_rate() const { - return network_controller_factory_.GetUpdate() - .target_rate->stable_target_rate; -} - DataRate CallClient::padding_rate() const { return network_controller_factory_.GetUpdate().pacer_config->pad_rate(); } diff --git a/third_party/libwebrtc/test/scenario/call_client.h b/third_party/libwebrtc/test/scenario/call_client.h @@ -131,7 +131,6 @@ class CallClient : public EmulatedNetworkReceiverInterface { return DataRate::BitsPerSec(GetStats().send_bandwidth_bps); } DataRate target_rate() const; - DataRate stable_target_rate() const; DataRate padding_rate() const; void UpdateBitrateConstraints(const BitrateConstraints& constraints); void SetRemoteBitrate(DataRate bitrate);