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}
This commit is contained in:
Sebastian Jansson 2019-07-16 16:31:50 +02:00 committed by Commit Bot
parent 17bfafe394
commit ea3dddf1d0
2 changed files with 28 additions and 19 deletions

View File

@ -236,11 +236,10 @@ struct NetworkStateEstimate {
// 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();

View File

@ -305,18 +305,24 @@ DataRate AimdRateControl::ChangeBitrate(DataRate new_bitrate,
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 @@ DataRate AimdRateControl::ClampBitrate(DataRate new_bitrate,
}
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_);