Cleanup: Removes unused AimdRateControl field trials.

Bug: webrtc:9883
Change-Id: I4a15ae20ea1fa7cc05a8e898fb6de35cd0fe4acc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/169849
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Christoffer Rodbro <crodbro@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30739}
This commit is contained in:
Sebastian Jansson
2020-03-10 11:40:45 +01:00
committed by Commit Bot
parent eac08bfe23
commit 5b60b19c62
3 changed files with 24 additions and 112 deletions

View File

@ -92,8 +92,6 @@ AimdRateControl::AimdRateControl(const WebRtcKeyValueConfig* key_value_config,
no_bitrate_increase_in_alr_(
IsEnabled(*key_value_config,
"WebRTC-DontIncreaseDelayBasedBweInAlr")),
smoothing_experiment_(
IsEnabled(*key_value_config, "WebRTC-Audio-BandwidthSmoothing")),
estimate_bounded_backoff_(
IsNotDisabled(*key_value_config,
"WebRTC-Bwe-EstimateBoundedBackoff")),
@ -101,13 +99,10 @@ AimdRateControl::AimdRateControl(const WebRtcKeyValueConfig* key_value_config,
IsNotDisabled(*key_value_config,
"WebRTC-Bwe-EstimateBoundedIncrease")),
initial_backoff_interval_("initial_backoff_interval"),
low_throughput_threshold_("low_throughput", DataRate::Zero()),
link_capacity_fix_("link_capacity_fix") {
// E.g
// WebRTC-BweAimdRateControlConfig/initial_backoff_interval:100ms,
// low_throughput:50kbps/
ParseFieldTrial({&initial_backoff_interval_, &low_throughput_threshold_,
&link_capacity_fix_},
// WebRTC-BweAimdRateControlConfig/initial_backoff_interval:100ms/
ParseFieldTrial({&initial_backoff_interval_, &link_capacity_fix_},
key_value_config->Lookup("WebRTC-BweAimdRateControlConfig"));
if (initial_backoff_interval_) {
RTC_LOG(LS_INFO) << "Using aimd rate control with initial back-off interval"
@ -247,14 +242,13 @@ double AimdRateControl::GetNearMaxIncreaseRateBpsPerSecond() const {
}
TimeDelta AimdRateControl::GetExpectedBandwidthPeriod() const {
const TimeDelta kMinPeriod =
smoothing_experiment_ ? TimeDelta::Millis(500) : TimeDelta::Seconds(2);
const TimeDelta kMinPeriod = TimeDelta::Seconds(2);
const TimeDelta kDefaultPeriod = TimeDelta::Seconds(3);
const TimeDelta kMaxPeriod = TimeDelta::Seconds(50);
double increase_rate_bps_per_second = GetNearMaxIncreaseRateBpsPerSecond();
if (!last_decrease_)
return smoothing_experiment_ ? kMinPeriod : kDefaultPeriod;
return kDefaultPeriod;
double time_to_recover_decrease_seconds =
last_decrease_->bps() / increase_rate_bps_per_second;
TimeDelta period = TimeDelta::Seconds(time_to_recover_decrease_seconds);
@ -323,48 +317,31 @@ void AimdRateControl::ChangeBitrate(const RateControlInput& input,
case kRcDecrease: {
DataRate decreased_bitrate = DataRate::PlusInfinity();
if (estimated_throughput > low_throughput_threshold_) {
// Set bit rate to something slightly lower than the measured throughput
// to get rid of any self-induced delay.
decreased_bitrate = estimated_throughput * beta_;
if (decreased_bitrate > current_bitrate_ && !link_capacity_fix_) {
// TODO(terelius): The link_capacity estimate may be based on old
// throughput measurements. Relying on them may lead to unnecessary
// BWE drops.
if (link_capacity_.has_estimate()) {
decreased_bitrate = beta_ * link_capacity_.estimate();
}
}
if (estimate_bounded_backoff_ && network_estimate_) {
decreased_bitrate =
std::max(decreased_bitrate,
network_estimate_->link_capacity_lower * beta_);
}
} else {
decreased_bitrate = estimated_throughput;
// Set bit rate to something slightly lower than the measured throughput
// to get rid of any self-induced delay.
decreased_bitrate = estimated_throughput * beta_;
if (decreased_bitrate > current_bitrate_ && !link_capacity_fix_) {
// TODO(terelius): The link_capacity estimate may be based on old
// throughput measurements. Relying on them may lead to unnecessary
// BWE drops.
if (link_capacity_.has_estimate()) {
decreased_bitrate =
std::max(decreased_bitrate, link_capacity_.estimate());
decreased_bitrate = beta_ * link_capacity_.estimate();
}
decreased_bitrate =
std::min(decreased_bitrate, low_throughput_threshold_.Get());
}
if (estimate_bounded_backoff_ && network_estimate_) {
decreased_bitrate = std::max(
decreased_bitrate, network_estimate_->link_capacity_lower * beta_);
}
// Avoid increasing the rate when over-using.
if (decreased_bitrate < current_bitrate_) {
new_bitrate = decreased_bitrate;
}
if (bitrate_is_initialized_ && estimated_throughput < current_bitrate_) {
constexpr double kDegradationFactor = 0.9;
if (!new_bitrate.has_value()) {
last_decrease_ = DataRate::Zero();
} else if (smoothing_experiment_ &&
*new_bitrate <
kDegradationFactor * beta_ * current_bitrate_) {
// If bitrate decreases more than a normal back off after overuse, it
// indicates a real network degradation. We do not let such a decrease
// to determine the bandwidth estimation period.
last_decrease_ = absl::nullopt;
} else {
last_decrease_ = current_bitrate_ - *new_bitrate;
}

View File

@ -102,7 +102,6 @@ class AimdRateControl {
// Allow the delay based estimate to only increase as long as application
// 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_;
@ -111,7 +110,6 @@ class AimdRateControl {
const bool estimate_bounded_increase_;
absl::optional<DataRate> last_decrease_;
FieldTrialOptional<TimeDelta> initial_backoff_interval_;
FieldTrialParameter<DataRate> low_throughput_threshold_;
FieldTrialFlag link_capacity_fix_;
};
} // namespace webrtc

View File

@ -21,12 +21,9 @@ namespace {
constexpr int64_t kClockInitialTime = 123456;
constexpr int kMinBwePeriodMsSmoothingExp = 500;
constexpr int kMinBwePeriodMsNoSmoothingExp = 2000;
constexpr int kDefaultPeriodMsNoSmoothingExp = 3000;
constexpr int kMinBwePeriodMs = 2000;
constexpr int kDefaultPeriodMs = 3000;
constexpr int kMaxBwePeriodMs = 50000;
constexpr char kSmoothingExpFieldTrial[] =
"WebRTC-Audio-BandwidthSmoothing/Enabled/";
// After an overuse, we back off to 85% to the received bitrate.
constexpr double kFractionAfterOveruse = 0.85;
@ -102,22 +99,7 @@ TEST(AimdRateControlTest, GetIncreaseRateAndBandwidthPeriod) {
EXPECT_NEAR(14000,
states.aimd_rate_control->GetNearMaxIncreaseRateBpsPerSecond(),
1000);
EXPECT_EQ(kDefaultPeriodMsNoSmoothingExp,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
}
TEST(AimdRateControlTest, GetIncreaseRateAndBandwidthPeriodSmoothingExp) {
// Smoothing experiment enabled
test::ScopedFieldTrials override_field_trials(kSmoothingExpFieldTrial);
auto states = CreateAimdRateControlStates();
constexpr int kBitrate = 300000;
SetEstimate(states, kBitrate);
UpdateRateControl(states, BandwidthUsage::kBwOverusing, kBitrate,
states.simulated_clock->TimeInMilliseconds());
EXPECT_NEAR(14000,
states.aimd_rate_control->GetNearMaxIncreaseRateBpsPerSecond(),
1000);
EXPECT_EQ(kMinBwePeriodMsSmoothingExp,
EXPECT_EQ(kDefaultPeriodMs,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
}
@ -162,26 +144,12 @@ TEST(AimdRateControlTest, DefaultPeriodUntilFirstOveruse) {
// Smoothing experiment disabled
auto states = CreateAimdRateControlStates();
states.aimd_rate_control->SetStartBitrate(DataRate::KilobitsPerSec(300));
EXPECT_EQ(kDefaultPeriodMsNoSmoothingExp,
EXPECT_EQ(kDefaultPeriodMs,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
states.simulated_clock->AdvanceTimeMilliseconds(100);
UpdateRateControl(states, BandwidthUsage::kBwOverusing, 280000,
states.simulated_clock->TimeInMilliseconds());
EXPECT_NE(kDefaultPeriodMsNoSmoothingExp,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
}
TEST(AimdRateControlTest, MinPeriodUntilFirstOveruseSmoothingExp) {
// Smoothing experiment enabled
test::ScopedFieldTrials override_field_trials(kSmoothingExpFieldTrial);
auto states = CreateAimdRateControlStates();
states.aimd_rate_control->SetStartBitrate(DataRate::KilobitsPerSec(300));
EXPECT_EQ(kMinBwePeriodMsSmoothingExp,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
states.simulated_clock->AdvanceTimeMilliseconds(100);
UpdateRateControl(states, BandwidthUsage::kBwOverusing, 280000,
states.simulated_clock->TimeInMilliseconds());
EXPECT_NE(kMinBwePeriodMsSmoothingExp,
EXPECT_NE(kDefaultPeriodMs,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
}
@ -201,22 +169,6 @@ TEST(AimdRateControlTest, ExpectedPeriodAfter20kbpsDropAnd5kbpsIncrease) {
EXPECT_EQ(4000, states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
}
TEST(AimdRateControlTest, MinPeriodAfterLargeBitrateDecreaseSmoothingExp) {
// Smoothing experiment enabled
test::ScopedFieldTrials override_field_trials(kSmoothingExpFieldTrial);
auto states = CreateAimdRateControlStates();
constexpr int kInitialBitrate = 110000;
SetEstimate(states, kInitialBitrate);
states.simulated_clock->AdvanceTimeMilliseconds(100);
// Make such a large drop in bitrate that should be treated as network
// degradation.
constexpr int kAckedBitrate = kInitialBitrate * 3 / 4 / kFractionAfterOveruse;
UpdateRateControl(states, BandwidthUsage::kBwOverusing, kAckedBitrate,
states.simulated_clock->TimeInMilliseconds());
EXPECT_EQ(kMinBwePeriodMsSmoothingExp,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
}
TEST(AimdRateControlTest, BandwidthPeriodIsNotBelowMin) {
auto states = CreateAimdRateControlStates();
constexpr int kInitialBitrate = 10000;
@ -225,22 +177,7 @@ TEST(AimdRateControlTest, BandwidthPeriodIsNotBelowMin) {
// Make a small (1.5 kbps) bitrate drop to 8.5 kbps.
UpdateRateControl(states, BandwidthUsage::kBwOverusing, kInitialBitrate - 1,
states.simulated_clock->TimeInMilliseconds());
EXPECT_EQ(kMinBwePeriodMsNoSmoothingExp,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
}
TEST(AimdRateControlTest, BandwidthPeriodIsNotAboveMaxSmoothingExp) {
// Smoothing experiment enabled
test::ScopedFieldTrials override_field_trials(kSmoothingExpFieldTrial);
auto states = CreateAimdRateControlStates();
constexpr int kInitialBitrate = 50000000;
SetEstimate(states, kInitialBitrate);
states.simulated_clock->AdvanceTimeMilliseconds(100);
// Make a large (10 Mbps) bitrate drop to 10 kbps.
constexpr int kAckedBitrate = 40000000 / kFractionAfterOveruse;
UpdateRateControl(states, BandwidthUsage::kBwOverusing, kAckedBitrate,
states.simulated_clock->TimeInMilliseconds());
EXPECT_EQ(kMaxBwePeriodMs,
EXPECT_EQ(kMinBwePeriodMs,
states.aimd_rate_control->GetExpectedBandwidthPeriod().ms());
}