From 7ea6b290d07cedf948fb53bdae4581809d8251fa Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Fri, 19 Jul 2019 17:13:11 +0200 Subject: [PATCH] Adds improved estimate bounded backoff to AimdRateControl. Bug: webrtc:10498 Change-Id: I4e006e437dfa667b738beb009a599bacc6778da5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146215 Reviewed-by: Jonas Olsson Commit-Queue: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#28632} --- .../aimd_rate_control.cc | 46 +++++++------------ .../aimd_rate_control.h | 9 +++- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/modules/remote_bitrate_estimator/aimd_rate_control.cc b/modules/remote_bitrate_estimator/aimd_rate_control.cc index 0b523819f3..21ae26d863 100644 --- a/modules/remote_bitrate_estimator/aimd_rate_control.cc +++ b/modules/remote_bitrate_estimator/aimd_rate_control.cc @@ -89,10 +89,13 @@ AimdRateControl::AimdRateControl(const WebRtcKeyValueConfig* key_value_config, "WebRTC-DontIncreaseDelayBasedBweInAlr")), smoothing_experiment_( IsEnabled(*key_value_config, "WebRTC-Audio-BandwidthSmoothing")), + estimate_bounded_backoff_( + IsEnabled(*key_value_config, "WebRTC-Bwe-EstimateBoundedBackoff")), + estimate_bounded_increase_( + IsEnabled(*key_value_config, "WebRTC-Bwe-EstimateBoundedIncrease")), initial_backoff_interval_("initial_backoff_interval"), low_throughput_threshold_("low_throughput", DataRate::Zero()), capacity_deviation_ratio_threshold_("cap_thr", 0.2), - cross_traffic_factor_("cross", 1.0), capacity_limit_deviation_factor_("cap_lim", 1) { // E.g // WebRTC-BweAimdRateControlConfig/initial_backoff_interval:100ms, @@ -105,8 +108,7 @@ AimdRateControl::AimdRateControl(const WebRtcKeyValueConfig* key_value_config, } RTC_LOG(LS_INFO) << "Using aimd rate control with back off factor " << beta_; ParseFieldTrial( - {&capacity_deviation_ratio_threshold_, &cross_traffic_factor_, - &capacity_limit_deviation_factor_}, + {&capacity_deviation_ratio_threshold_, &capacity_limit_deviation_factor_}, key_value_config->Lookup("WebRTC-Bwe-AimdRateControl-NetworkState")); } @@ -304,26 +306,11 @@ DataRate AimdRateControl::ChangeBitrate(DataRate new_bitrate, break; case kRcDecrease: - if (network_estimate_ && capacity_deviation_ratio_threshold_) { - DataRate lower_bound = network_estimate_->link_capacity_lower; - // TODO(srte): Remove this when link_capacity_lower is available. - if (lower_bound.IsInfinite()) { - // If we have a low variance network estimate, we use it over the - // acknowledged rate to avoid dropping the bitrate too far. This - // avoids overcompensating when the send rate is lower than the - // capacity. - double deviation_ratio = network_estimate_->link_capacity_std_dev / - network_estimate_->link_capacity; - if (deviation_ratio < *capacity_deviation_ratio_threshold_) { - double available_ratio = - std::max(0.0, 1.0 - network_estimate_->cross_traffic_ratio * - cross_traffic_factor_); - lower_bound = network_estimate_->link_capacity * available_ratio; - } - } - if (lower_bound > DataRate::Zero()) { - estimated_throughput = std::max(lower_bound, estimated_throughput); - } + // TODO(srte): Remove when |estimate_bounded_backoff_| has been validated. + if (network_estimate_ && capacity_deviation_ratio_threshold_ && + !estimate_bounded_backoff_) { + estimated_throughput = std::max(estimated_throughput, + network_estimate_->link_capacity_lower); } if (estimated_throughput > low_throughput_threshold_) { // Set bit rate to something slightly lower than the measured throughput @@ -335,6 +322,10 @@ DataRate AimdRateControl::ChangeBitrate(DataRate new_bitrate, new_bitrate = beta_ * link_capacity_.estimate(); } } + if (estimate_bounded_backoff_ && network_estimate_) { + new_bitrate = std::max( + new_bitrate, network_estimate_->link_capacity_lower * beta_); + } } else { new_bitrate = estimated_throughput; if (link_capacity_.has_estimate()) { @@ -393,14 +384,9 @@ DataRate AimdRateControl::ClampBitrate(DataRate new_bitrate, } } - if (network_estimate_ && capacity_limit_deviation_factor_) { + if (network_estimate_ && + (estimate_bounded_increase_ || capacity_limit_deviation_factor_)) { DataRate upper_bound = network_estimate_->link_capacity_upper; - // TODO(srte): Remove this when link_capacity_lower is available. - if (upper_bound.IsMinusInfinity()) { - upper_bound = network_estimate_->link_capacity + - network_estimate_->link_capacity_std_dev * - capacity_limit_deviation_factor_.Value(); - } new_bitrate = std::min(new_bitrate, upper_bound); } new_bitrate = std::max(new_bitrate, min_configured_bitrate_); diff --git a/modules/remote_bitrate_estimator/aimd_rate_control.h b/modules/remote_bitrate_estimator/aimd_rate_control.h index d1a1caa12a..3b150bc9c1 100644 --- a/modules/remote_bitrate_estimator/aimd_rate_control.h +++ b/modules/remote_bitrate_estimator/aimd_rate_control.h @@ -108,11 +108,18 @@ class AimdRateControl { // limited region (alr) is not detected. const bool no_bitrate_increase_in_alr_; const bool smoothing_experiment_; + // Use estimated link capacity lower bound if it is higher than the + // acknowledged rate when backing off due to overuse. + const bool estimate_bounded_backoff_; + // Use estimated link capacity upper bound as upper limit for increasing + // bitrate over the acknowledged rate. + const bool estimate_bounded_increase_; absl::optional last_decrease_; FieldTrialOptional initial_backoff_interval_; FieldTrialParameter low_throughput_threshold_; + // Deprecated, enable |estimate_bounded_backoff_| instead. FieldTrialOptional capacity_deviation_ratio_threshold_; - FieldTrialParameter cross_traffic_factor_; + // Deprecated, enable |estimate_bounded_increase_| instead. FieldTrialOptional capacity_limit_deviation_factor_; }; } // namespace webrtc