diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc index 226c4f0f7f..92b99f1c46 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc @@ -100,11 +100,11 @@ GoogCcNetworkController::GoogCcNetworkController(RtcEventLog* event_log, fall_back_to_probe_rate_( key_value_config_->Lookup("WebRTC-Bwe-ProbeRateFallback") .find("Enabled") == 0), - rate_control_experiments_( + rate_control_settings_( RateControlSettings::ParseFromKeyValueConfig(key_value_config_)), probe_controller_(new ProbeController(key_value_config_)), congestion_window_pushback_controller_( - rate_control_experiments_.UseCongestionWindowPushback() + rate_control_settings_.UseCongestionWindowPushback() ? absl::make_unique( key_value_config_) : nullptr), @@ -315,9 +315,13 @@ NetworkControlUpdate GoogCcNetworkController::OnStreamsConfig( } if (msg.max_total_allocated_bitrate && *msg.max_total_allocated_bitrate != max_total_allocated_bitrate_) { - update.probe_cluster_configs = - probe_controller_->OnMaxTotalAllocatedBitrate( - msg.max_total_allocated_bitrate->bps(), msg.at_time.ms()); + if (rate_control_settings_.TriggerProbeOnMaxAllocatedBitrateChange()) { + update.probe_cluster_configs = + probe_controller_->OnMaxTotalAllocatedBitrate( + msg.max_total_allocated_bitrate->bps(), msg.at_time.ms()); + } else { + probe_controller_->SetMaxBitrate(msg.max_total_allocated_bitrate->bps()); + } max_total_allocated_bitrate_ = *msg.max_total_allocated_bitrate; } bool pacing_changed = false; @@ -544,7 +548,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback( // No valid RTT could be because send-side BWE isn't used, in which case // we don't try to limit the outstanding packets. - if (rate_control_experiments_.UseCongestionWindow() && + if (rate_control_settings_.UseCongestionWindow() && max_feedback_rtt.IsFinite()) { int64_t min_feedback_max_rtt_ms = *std::min_element(feedback_max_rtts_.begin(), feedback_max_rtts_.end()); @@ -552,7 +556,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback( const DataSize kMinCwnd = DataSize::bytes(2 * 1500); TimeDelta time_window = TimeDelta::ms( min_feedback_max_rtt_ms + - rate_control_experiments_.GetCongestionWindowAdditionalTimeMs()); + rate_control_settings_.GetCongestionWindowAdditionalTimeMs()); DataSize data_window = last_raw_target_rate_ * time_window; if (current_data_window_) { data_window = diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.h b/modules/congestion_controller/goog_cc/goog_cc_network_control.h index f60d31d5b7..44de8b771a 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control.h +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.h @@ -79,7 +79,7 @@ class GoogCcNetworkController : public NetworkControllerInterface { FieldTrialFlag safe_reset_acknowledged_rate_; const bool use_stable_bandwidth_estimate_; const bool fall_back_to_probe_rate_; - const RateControlSettings rate_control_experiments_; + const RateControlSettings rate_control_settings_; const std::unique_ptr probe_controller_; const std::unique_ptr diff --git a/rtc_base/experiments/rate_control_settings.cc b/rtc_base/experiments/rate_control_settings.cc index 6192a15b27..f465933e54 100644 --- a/rtc_base/experiments/rate_control_settings.cc +++ b/rtc_base/experiments/rate_control_settings.cc @@ -120,11 +120,13 @@ RateControlSettings::RateControlSettings( "screenshare_hysteresis", ParseHysteresisFactor(key_value_config, kScreenshareHysteresisFieldTrialname, - kDefaultScreenshareHysteresisFactor)) { - ParseFieldTrial({&congestion_window_, &congestion_window_pushback_, - &pacing_factor_, &alr_probing_, &trust_vp8_, &trust_vp9_, - &video_hysteresis_, &screenshare_hysteresis_}, - key_value_config->Lookup("WebRTC-VideoRateControl")); + kDefaultScreenshareHysteresisFactor)), + probe_max_allocation_("probe_max_allocation", true) { + ParseFieldTrial( + {&congestion_window_, &congestion_window_pushback_, &pacing_factor_, + &alr_probing_, &trust_vp8_, &trust_vp9_, &video_hysteresis_, + &screenshare_hysteresis_, &probe_max_allocation_}, + key_value_config->Lookup("WebRTC-VideoRateControl")); } RateControlSettings::~RateControlSettings() = default; @@ -184,4 +186,8 @@ double RateControlSettings::GetSimulcastScreenshareHysteresisFactor() const { return screenshare_hysteresis_.Get(); } +bool RateControlSettings::TriggerProbeOnMaxAllocatedBitrateChange() const { + return probe_max_allocation_.Get(); +} + } // namespace webrtc diff --git a/rtc_base/experiments/rate_control_settings.h b/rtc_base/experiments/rate_control_settings.h index ff071d8fde..cbc2e69d79 100644 --- a/rtc_base/experiments/rate_control_settings.h +++ b/rtc_base/experiments/rate_control_settings.h @@ -44,6 +44,8 @@ class RateControlSettings final { double GetSimulcastVideoHysteresisFactor() const; double GetSimulcastScreenshareHysteresisFactor() const; + bool TriggerProbeOnMaxAllocatedBitrateChange() const; + private: explicit RateControlSettings( const WebRtcKeyValueConfig* const key_value_config); @@ -56,6 +58,7 @@ class RateControlSettings final { FieldTrialParameter trust_vp9_; FieldTrialParameter video_hysteresis_; FieldTrialParameter screenshare_hysteresis_; + FieldTrialParameter probe_max_allocation_; }; } // namespace webrtc