Enable configuring probes via field trial.

This CL adds a field trial that lets us control the size of the initial probes, how we grow the following probes and how big and frequent our ALR probes are.

Bug: webrtc:10394
Change-Id: I6c7783dfada9aaf55cd836dd8991bb7b8ca4993b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126880
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27077}
This commit is contained in:
Jonas Olsson
2019-03-12 13:49:26 +01:00
committed by Commit Bot
parent cb96809e46
commit e096004745
4 changed files with 101 additions and 33 deletions

View File

@ -15,7 +15,9 @@
#include "api/units/timestamp.h"
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "modules/congestion_controller/goog_cc/probe_controller.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/clock.h"
#include "test/field_trial.h"
#include "test/gmock.h"
#include "test/gtest.h"
@ -61,7 +63,7 @@ class ProbeControllerTest : public ::testing::Test {
FieldTrialBasedConfig field_trial_config_;
SimulatedClock clock_;
MockRtcEventLog mock_rtc_event_log;
NiceMock<MockRtcEventLog> mock_rtc_event_log;
std::unique_ptr<ProbeController> probe_controller_;
};
@ -89,6 +91,7 @@ TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncrease) {
probes = probe_controller_->Process(NowMs());
probes = probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
kMaxBitrateBps + 100, NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), kMaxBitrateBps + 100);
}
@ -102,6 +105,7 @@ TEST_F(ProbeControllerTest, InitiatesProbingOnMaxBitrateIncreaseAtMaxBitrate) {
probes = probe_controller_->SetEstimatedBitrate(kMaxBitrateBps, NowMs());
probes = probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
kMaxBitrateBps + 100, NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), kMaxBitrateBps + 100);
}
@ -115,6 +119,7 @@ TEST_F(ProbeControllerTest, TestExponentialProbing) {
EXPECT_EQ(probes.size(), 0u);
probes = probe_controller_->SetEstimatedBitrate(1800, NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), 2 * 1800);
}
@ -252,6 +257,7 @@ TEST_F(ProbeControllerTest, PeriodicProbingAfterReset) {
// until SetEstimatedBitrate is called with an updated estimate.
clock_.AdvanceTimeMilliseconds(10000);
probes = probe_controller_->Process(NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), kStartBitrateBps * 2);
}
@ -262,6 +268,7 @@ TEST_F(ProbeControllerTest, TestExponentialProbingOverflow) {
// Verify that probe bitrate is capped at the specified max bitrate.
probes =
probe_controller_->SetEstimatedBitrate(60 * kMbpsMultiplier, NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), 100 * kMbpsMultiplier);
// Verify that repeated probes aren't sent.
probes =
@ -293,6 +300,7 @@ TEST_F(ProbeControllerTest, TestAllocatedBitrateCap) {
// Probes such as ALR capped at 2x the max allocation limit.
clock_.AdvanceTimeMilliseconds(5000);
probes = probe_controller_->Process(NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), 2 * max_allocated_bps);
// Remove allocation limit.
@ -300,8 +308,31 @@ TEST_F(ProbeControllerTest, TestAllocatedBitrateCap) {
probe_controller_->OnMaxTotalAllocatedBitrate(0, NowMs()).empty());
clock_.AdvanceTimeMilliseconds(5000);
probes = probe_controller_->Process(NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), estimated_bitrate_bps * 2);
}
TEST_F(ProbeControllerTest, ConfigurableProbingFieldTrial) {
auto trials = test::ScopedFieldTrials(
"WebRTC-Bwe-ConfigurableProbing/"
"p1:2,p2:5,step_size:3,further_probe_threshold:0.8/");
probe_controller_.reset(
new ProbeController(&field_trial_config_, &mock_rtc_event_log));
auto probes = probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
kMaxBitrateBps, NowMs());
EXPECT_EQ(probes.size(), 2u);
EXPECT_EQ(probes[0].target_data_rate.bps(), 600);
EXPECT_EQ(probes[1].target_data_rate.bps(), 1500);
// Repeated probe should only be sent when estimated bitrate climbs above
// 0.8 * 5 * kStartBitrateBps = 1200.
probes = probe_controller_->SetEstimatedBitrate(1100, NowMs());
EXPECT_EQ(probes.size(), 0u);
probes = probe_controller_->SetEstimatedBitrate(1250, NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), 3 * 1250);
}
} // namespace test
} // namespace webrtc