This is a rollback of https://chromium-review.googlesource.com/c/external/webrtc/+/616724
it degraded results of the ANA testing BUG=webrtc:8105 Review-Url: https://codereview.webrtc.org/3011323002 Cr-Commit-Position: refs/heads/master@{#19902}
This commit is contained in:
@ -139,6 +139,15 @@ TEST_F(DelayBasedBweTest, ProbeDetectionSlowerArrivalHighBitrate) {
|
|||||||
kTargetUtilizationFraction * 4000000u, 10000u);
|
kTargetUtilizationFraction * 4000000u, 10000u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DelayBasedBweTest, GetExpectedBwePeriodMs) {
|
||||||
|
int64_t default_interval_ms = bitrate_estimator_->GetExpectedBwePeriodMs();
|
||||||
|
EXPECT_GT(default_interval_ms, 0);
|
||||||
|
CapacityDropTestHelper(1, true, 333, 0);
|
||||||
|
int64_t interval_ms = bitrate_estimator_->GetExpectedBwePeriodMs();
|
||||||
|
EXPECT_GT(interval_ms, 0);
|
||||||
|
EXPECT_NE(interval_ms, default_interval_ms);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DelayBasedBweTest, InitialBehavior) {
|
TEST_F(DelayBasedBweTest, InitialBehavior) {
|
||||||
InitialBehaviorTestHelper(730000);
|
InitialBehaviorTestHelper(730000);
|
||||||
}
|
}
|
||||||
|
@ -136,12 +136,13 @@ int AimdRateControl::GetNearMaxIncreaseRateBps() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int AimdRateControl::GetExpectedBandwidthPeriodMs() const {
|
int AimdRateControl::GetExpectedBandwidthPeriodMs() const {
|
||||||
constexpr int kMinPeriodMs = 500;
|
constexpr int kMinPeriodMs = 2000;
|
||||||
|
constexpr int kDefaultPeriodMs = 3000;
|
||||||
constexpr int kMaxPeriodMs = 50000;
|
constexpr int kMaxPeriodMs = 50000;
|
||||||
|
|
||||||
int increase_rate = GetNearMaxIncreaseRateBps();
|
int increase_rate = GetNearMaxIncreaseRateBps();
|
||||||
if (!last_decrease_)
|
if (!last_decrease_)
|
||||||
return kMinPeriodMs;
|
return kDefaultPeriodMs;
|
||||||
|
|
||||||
return std::min(kMaxPeriodMs,
|
return std::min(kMaxPeriodMs,
|
||||||
std::max<int>(1000 * static_cast<int64_t>(*last_decrease_) /
|
std::max<int>(1000 * static_cast<int64_t>(*last_decrease_) /
|
||||||
@ -210,17 +211,8 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t new_bitrate_bps,
|
|||||||
|
|
||||||
if (bitrate_is_initialized_ &&
|
if (bitrate_is_initialized_ &&
|
||||||
incoming_bitrate_bps < current_bitrate_bps_) {
|
incoming_bitrate_bps < current_bitrate_bps_) {
|
||||||
constexpr float kDegradationFactor = 0.9f;
|
last_decrease_ =
|
||||||
if (new_bitrate_bps <
|
rtc::Optional<int>(current_bitrate_bps_ - new_bitrate_bps);
|
||||||
kDegradationFactor * beta_ * current_bitrate_bps_) {
|
|
||||||
// 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_ = rtc::Optional<int>();
|
|
||||||
} else {
|
|
||||||
last_decrease_ = rtc::Optional<int>(
|
|
||||||
current_bitrate_bps_ - new_bitrate_bps);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (incoming_bitrate_kbps <
|
if (incoming_bitrate_kbps <
|
||||||
avg_max_bitrate_kbps_ - 3 * std_max_bit_rate) {
|
avg_max_bitrate_kbps_ - 3 * std_max_bit_rate) {
|
||||||
|
@ -18,8 +18,9 @@ namespace {
|
|||||||
|
|
||||||
constexpr int64_t kClockInitialTime = 123456;
|
constexpr int64_t kClockInitialTime = 123456;
|
||||||
|
|
||||||
constexpr int kMinBwePeriodMs = 500;
|
constexpr int kMinBwePeriodMs = 2000;
|
||||||
constexpr int kMaxBwePeriodMs = 50000;
|
constexpr int kMaxBwePeriodMs = 50000;
|
||||||
|
constexpr int kDefaultPeriodMs = 3000;
|
||||||
|
|
||||||
// After an overuse, we back off to 85% to the received bitrate.
|
// After an overuse, we back off to 85% to the received bitrate.
|
||||||
constexpr double kFractionAfterOveruse = 0.85;
|
constexpr double kFractionAfterOveruse = 0.85;
|
||||||
@ -81,8 +82,7 @@ TEST(AimdRateControlTest, GetIncreaseRateAndBandwidthPeriod) {
|
|||||||
states.simulated_clock->TimeInMilliseconds());
|
states.simulated_clock->TimeInMilliseconds());
|
||||||
EXPECT_NEAR(14000, states.aimd_rate_control->GetNearMaxIncreaseRateBps(),
|
EXPECT_NEAR(14000, states.aimd_rate_control->GetNearMaxIncreaseRateBps(),
|
||||||
1000);
|
1000);
|
||||||
EXPECT_EQ(kMinBwePeriodMs,
|
EXPECT_EQ(3000, states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
||||||
states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AimdRateControlTest, BweLimitedByAckedBitrate) {
|
TEST(AimdRateControlTest, BweLimitedByAckedBitrate) {
|
||||||
@ -124,15 +124,15 @@ TEST(AimdRateControlTest, BweNotLimitedByDecreasingAckedBitrate) {
|
|||||||
EXPECT_EQ(new_estimate, prev_estimate);
|
EXPECT_EQ(new_estimate, prev_estimate);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AimdRateControlTest, MinPeriodUntilFirstOveruse) {
|
TEST(AimdRateControlTest, DefaultPeriodUntilFirstOveruse) {
|
||||||
auto states = CreateAimdRateControlStates();
|
auto states = CreateAimdRateControlStates();
|
||||||
states.aimd_rate_control->SetStartBitrate(300000);
|
states.aimd_rate_control->SetStartBitrate(300000);
|
||||||
EXPECT_EQ(kMinBwePeriodMs,
|
EXPECT_EQ(kDefaultPeriodMs,
|
||||||
states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
||||||
states.simulated_clock->AdvanceTimeMilliseconds(100);
|
states.simulated_clock->AdvanceTimeMilliseconds(100);
|
||||||
UpdateRateControl(states, BandwidthUsage::kBwOverusing, 280000,
|
UpdateRateControl(states, BandwidthUsage::kBwOverusing, 100000,
|
||||||
states.simulated_clock->TimeInMilliseconds());
|
states.simulated_clock->TimeInMilliseconds());
|
||||||
EXPECT_NE(kMinBwePeriodMs,
|
EXPECT_NE(kDefaultPeriodMs,
|
||||||
states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,21 +152,6 @@ TEST(AimdRateControlTest, ExpectedPeriodAfter20kbpsDropAnd5kbpsIncrease) {
|
|||||||
EXPECT_EQ(4000, states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
EXPECT_EQ(4000, states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AimdRateControlTest, MinPeriodAfterLargeBitrateDecrease) {
|
|
||||||
auto states = CreateAimdRateControlStates();
|
|
||||||
constexpr int kInitialBitrate = 110000;
|
|
||||||
states.aimd_rate_control->SetEstimate(
|
|
||||||
kInitialBitrate, states.simulated_clock->TimeInMilliseconds());
|
|
||||||
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(kMinBwePeriodMs,
|
|
||||||
states.aimd_rate_control->GetExpectedBandwidthPeriodMs());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(AimdRateControlTest, BandwidthPeriodIsNotBelowMin) {
|
TEST(AimdRateControlTest, BandwidthPeriodIsNotBelowMin) {
|
||||||
auto states = CreateAimdRateControlStates();
|
auto states = CreateAimdRateControlStates();
|
||||||
constexpr int kInitialBitrate = 10000;
|
constexpr int kInitialBitrate = 10000;
|
||||||
@ -182,12 +167,12 @@ TEST(AimdRateControlTest, BandwidthPeriodIsNotBelowMin) {
|
|||||||
|
|
||||||
TEST(AimdRateControlTest, BandwidthPeriodIsNotAboveMax) {
|
TEST(AimdRateControlTest, BandwidthPeriodIsNotAboveMax) {
|
||||||
auto states = CreateAimdRateControlStates();
|
auto states = CreateAimdRateControlStates();
|
||||||
constexpr int kInitialBitrate = 50000000;
|
constexpr int kInitialBitrate = 10010000;
|
||||||
states.aimd_rate_control->SetEstimate(
|
states.aimd_rate_control->SetEstimate(
|
||||||
kInitialBitrate, states.simulated_clock->TimeInMilliseconds());
|
kInitialBitrate, states.simulated_clock->TimeInMilliseconds());
|
||||||
states.simulated_clock->AdvanceTimeMilliseconds(100);
|
states.simulated_clock->AdvanceTimeMilliseconds(100);
|
||||||
// Make a large (10 Mbps) bitrate drop to 10 kbps.
|
// Make a large (10 Mbps) bitrate drop to 10 kbps.
|
||||||
constexpr int kAckedBitrate = 40000000 / kFractionAfterOveruse;
|
constexpr int kAckedBitrate = 10000 / kFractionAfterOveruse;
|
||||||
UpdateRateControl(states, BandwidthUsage::kBwOverusing, kAckedBitrate,
|
UpdateRateControl(states, BandwidthUsage::kBwOverusing, kAckedBitrate,
|
||||||
states.simulated_clock->TimeInMilliseconds());
|
states.simulated_clock->TimeInMilliseconds());
|
||||||
EXPECT_EQ(kMaxBwePeriodMs,
|
EXPECT_EQ(kMaxBwePeriodMs,
|
||||||
|
Reference in New Issue
Block a user