Make the OnMaxTotalAllocation probes configurable.
This CL allows us to control how many probes we send when the bandwidth
allocation is updated, and how big they are.
Bug: webrtc:10394
Change-Id: I19e40740a528f83384b65d7509295034cc9a3031
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129904
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27317}
diff --git a/modules/congestion_controller/goog_cc/probe_controller.cc b/modules/congestion_controller/goog_cc/probe_controller.cc
index e5a6d1f..3ff96c4 100644
--- a/modules/congestion_controller/goog_cc/probe_controller.cc
+++ b/modules/congestion_controller/goog_cc/probe_controller.cc
@@ -91,16 +91,20 @@
ProbeControllerConfig::ProbeControllerConfig(
const WebRtcKeyValueConfig* key_value_config)
- : first_exponential_probe_scale_("p1", 3.0),
- second_exponential_probe_scale_("p2", 6.0),
- further_exponential_probe_scale_("step_size", 2),
+ : first_exponential_probe_scale("p1", 3.0),
+ second_exponential_probe_scale("p2", 6.0),
+ further_exponential_probe_scale("step_size", 2),
further_probe_threshold("further_probe_threshold", 0.7),
- alr_probing_interval_("alr_interval", TimeDelta::seconds(5)),
- alr_probe_scale_("alr_scale", 2) {
+ alr_probing_interval("alr_interval", TimeDelta::seconds(5)),
+ alr_probe_scale("alr_scale", 2),
+ first_allocation_probe_scale("alloc_p1", 1),
+ second_allocation_probe_scale("alloc_p2", 2),
+ allocation_allow_further_probing("alloc_probe_further", false) {
ParseFieldTrial(
- {&first_exponential_probe_scale_, &second_exponential_probe_scale_,
- &further_exponential_probe_scale_, &further_probe_threshold,
- &alr_probing_interval_, &alr_probe_scale_},
+ {&first_exponential_probe_scale, &second_exponential_probe_scale,
+ &further_exponential_probe_scale, &further_probe_threshold,
+ &alr_probing_interval, &alr_probe_scale, &first_allocation_probe_scale,
+ &second_allocation_probe_scale, &allocation_allow_further_probing},
key_value_config->Lookup("WebRTC-Bwe-ProbingConfiguration"));
}
@@ -183,11 +187,19 @@
(max_bitrate_bps_ <= 0 || estimated_bitrate_bps_ < max_bitrate_bps_) &&
estimated_bitrate_bps_ < max_total_allocated_bitrate) {
max_total_allocated_bitrate_ = max_total_allocated_bitrate;
- // Also probe at 2x the max bitrate, to account for the transmission max
- // bitrate multiplier functionality of the BitrateAllocator.
- return InitiateProbing(
- at_time_ms,
- {max_total_allocated_bitrate, 2 * max_total_allocated_bitrate}, false);
+
+ if (!config_.first_allocation_probe_scale)
+ return std::vector<ProbeClusterConfig>();
+
+ std::vector<int64_t> probes = {
+ static_cast<int64_t>(config_.first_allocation_probe_scale.Value() *
+ max_total_allocated_bitrate)};
+ if (config_.second_allocation_probe_scale) {
+ probes.push_back(config_.second_allocation_probe_scale.Value() *
+ max_total_allocated_bitrate);
+ }
+ return InitiateProbing(at_time_ms, probes,
+ config_.allocation_allow_further_probing);
}
max_total_allocated_bitrate_ = max_total_allocated_bitrate;
return std::vector<ProbeClusterConfig>();
@@ -216,9 +228,9 @@
// When probing at 1.8 Mbps ( 6x 300), this represents a threshold of
// 1.2 Mbps to continue probing.
std::vector<int64_t> probes = {static_cast<int64_t>(
- config_.first_exponential_probe_scale_ * start_bitrate_bps_)};
- if (config_.second_exponential_probe_scale_) {
- probes.push_back(config_.second_exponential_probe_scale_.Value() *
+ config_.first_exponential_probe_scale * start_bitrate_bps_)};
+ if (config_.second_exponential_probe_scale) {
+ probes.push_back(config_.second_exponential_probe_scale.Value() *
start_bitrate_bps_);
}
return InitiateProbing(at_time_ms, probes, true);
@@ -247,7 +259,7 @@
bitrate_bps > min_bitrate_to_probe_further_bps_) {
pending_probes = InitiateProbing(
at_time_ms,
- {static_cast<int64_t>(config_.further_exponential_probe_scale_ *
+ {static_cast<int64_t>(config_.further_exponential_probe_scale *
bitrate_bps)},
true);
}
@@ -348,11 +360,11 @@
if (alr_start_time_ms_ && estimated_bitrate_bps_ > 0) {
int64_t next_probe_time_ms =
std::max(*alr_start_time_ms_, time_last_probing_initiated_ms_) +
- config_.alr_probing_interval_->ms();
+ config_.alr_probing_interval->ms();
if (at_time_ms >= next_probe_time_ms) {
return InitiateProbing(at_time_ms,
{static_cast<int64_t>(estimated_bitrate_bps_ *
- config_.alr_probe_scale_)},
+ config_.alr_probe_scale)},
true);
}
}
diff --git a/modules/congestion_controller/goog_cc/probe_controller.h b/modules/congestion_controller/goog_cc/probe_controller.h
index d0efb27..ebf8c94 100644
--- a/modules/congestion_controller/goog_cc/probe_controller.h
+++ b/modules/congestion_controller/goog_cc/probe_controller.h
@@ -39,14 +39,19 @@
// Then whenever we get a bitrate estimate of at least further_probe_threshold
// times the size of the last sent probe we'll send another one of size
// step_size times the new estimate.
- FieldTrialParameter<double> first_exponential_probe_scale_;
- FieldTrialOptional<double> second_exponential_probe_scale_;
- FieldTrialParameter<double> further_exponential_probe_scale_;
+ FieldTrialParameter<double> first_exponential_probe_scale;
+ FieldTrialOptional<double> second_exponential_probe_scale;
+ FieldTrialParameter<double> further_exponential_probe_scale;
FieldTrialParameter<double> further_probe_threshold;
// Configures how often we send ALR probes and how big they are.
- FieldTrialParameter<TimeDelta> alr_probing_interval_;
- FieldTrialParameter<double> alr_probe_scale_;
+ FieldTrialParameter<TimeDelta> alr_probing_interval;
+ FieldTrialParameter<double> alr_probe_scale;
+
+ // Configures the probes emitted by changed to the allocated bitrate.
+ FieldTrialOptional<double> first_allocation_probe_scale;
+ FieldTrialOptional<double> second_allocation_probe_scale;
+ FieldTrialFlag allocation_allow_further_probing;
};
// This class controls initiation of probing to estimate initial channel
diff --git a/modules/congestion_controller/goog_cc/probe_controller_unittest.cc b/modules/congestion_controller/goog_cc/probe_controller_unittest.cc
index 7aba8e1..46b661c 100644
--- a/modules/congestion_controller/goog_cc/probe_controller_unittest.cc
+++ b/modules/congestion_controller/goog_cc/probe_controller_unittest.cc
@@ -315,11 +315,12 @@
TEST_F(ProbeControllerTest, ConfigurableProbingFieldTrial) {
test::ScopedFieldTrials trials(
"WebRTC-Bwe-ProbingConfiguration/"
- "p1:2,p2:5,step_size:3,further_probe_threshold:0.8/");
+ "p1:2,p2:5,step_size:3,further_probe_threshold:0.8,"
+ "alloc_p1:2,alloc_p2/");
probe_controller_.reset(
new ProbeController(&field_trial_config_, &mock_rtc_event_log));
auto probes = probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
- kMaxBitrateBps, NowMs());
+ 5000000, NowMs());
EXPECT_EQ(probes.size(), 2u);
EXPECT_EQ(probes[0].target_data_rate.bps(), 600);
EXPECT_EQ(probes[1].target_data_rate.bps(), 1500);
@@ -332,6 +333,13 @@
probes = probe_controller_->SetEstimatedBitrate(1250, NowMs());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes[0].target_data_rate.bps(), 3 * 1250);
+
+ clock_.AdvanceTimeMilliseconds(5000);
+ probes = probe_controller_->Process(NowMs());
+
+ probes = probe_controller_->OnMaxTotalAllocatedBitrate(200000, NowMs());
+ EXPECT_EQ(probes.size(), 1u);
+ EXPECT_EQ(probes[0].target_data_rate.bps(), 400000);
}
} // namespace test