Use capacity bounds in AimdRateControl if available.
Bug: webrtc:10742
Change-Id: I139f7053d33092efe6430d82596b05c730855383
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145725
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28584}
diff --git a/api/transport/network_types.h b/api/transport/network_types.h
index 45b651e..9e79bce 100644
--- a/api/transport/network_types.h
+++ b/api/transport/network_types.h
@@ -236,11 +236,10 @@
// Total estimated link capacity.
DataRate link_capacity = DataRate::MinusInfinity();
- // Lower bound of link capacity estimate.
+ // Used as a safe measure of available capacity.
DataRate link_capacity_lower = DataRate::MinusInfinity();
- // Expected available capacity for sending data after cross traffic is taken
- // into consideration.
- DataRate available_capacity = DataRate::MinusInfinity();
+ // Used as limit for increasing bitrate.
+ DataRate link_capacity_upper = DataRate::MinusInfinity();
TimeDelta pre_link_buffer_delay = TimeDelta::MinusInfinity();
TimeDelta post_link_buffer_delay = TimeDelta::MinusInfinity();
diff --git a/modules/remote_bitrate_estimator/aimd_rate_control.cc b/modules/remote_bitrate_estimator/aimd_rate_control.cc
index 1e5d292..0b52381 100644
--- a/modules/remote_bitrate_estimator/aimd_rate_control.cc
+++ b/modules/remote_bitrate_estimator/aimd_rate_control.cc
@@ -305,18 +305,24 @@
case kRcDecrease:
if (network_estimate_ && capacity_deviation_ratio_threshold_) {
- // 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_);
- DataRate available_rate =
- network_estimate_->link_capacity * available_ratio;
- estimated_throughput = std::max(available_rate, estimated_throughput);
+ 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);
}
}
if (estimated_throughput > low_throughput_threshold_) {
@@ -388,9 +394,13 @@
}
if (network_estimate_ && capacity_limit_deviation_factor_) {
- DataRate upper_bound = network_estimate_->link_capacity +
- network_estimate_->link_capacity_std_dev *
- capacity_limit_deviation_factor_.Value();
+ 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_);