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}
This commit is contained in:
@ -91,16 +91,20 @@ void MaybeLogProbeClusterCreated(RtcEventLog* event_log,
|
|||||||
|
|
||||||
ProbeControllerConfig::ProbeControllerConfig(
|
ProbeControllerConfig::ProbeControllerConfig(
|
||||||
const WebRtcKeyValueConfig* key_value_config)
|
const WebRtcKeyValueConfig* key_value_config)
|
||||||
: first_exponential_probe_scale_("p1", 3.0),
|
: first_exponential_probe_scale("p1", 3.0),
|
||||||
second_exponential_probe_scale_("p2", 6.0),
|
second_exponential_probe_scale("p2", 6.0),
|
||||||
further_exponential_probe_scale_("step_size", 2),
|
further_exponential_probe_scale("step_size", 2),
|
||||||
further_probe_threshold("further_probe_threshold", 0.7),
|
further_probe_threshold("further_probe_threshold", 0.7),
|
||||||
alr_probing_interval_("alr_interval", TimeDelta::seconds(5)),
|
alr_probing_interval("alr_interval", TimeDelta::seconds(5)),
|
||||||
alr_probe_scale_("alr_scale", 2) {
|
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(
|
ParseFieldTrial(
|
||||||
{&first_exponential_probe_scale_, &second_exponential_probe_scale_,
|
{&first_exponential_probe_scale, &second_exponential_probe_scale,
|
||||||
&further_exponential_probe_scale_, &further_probe_threshold,
|
&further_exponential_probe_scale, &further_probe_threshold,
|
||||||
&alr_probing_interval_, &alr_probe_scale_},
|
&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"));
|
key_value_config->Lookup("WebRTC-Bwe-ProbingConfiguration"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,11 +187,19 @@ std::vector<ProbeClusterConfig> ProbeController::OnMaxTotalAllocatedBitrate(
|
|||||||
(max_bitrate_bps_ <= 0 || estimated_bitrate_bps_ < max_bitrate_bps_) &&
|
(max_bitrate_bps_ <= 0 || estimated_bitrate_bps_ < max_bitrate_bps_) &&
|
||||||
estimated_bitrate_bps_ < max_total_allocated_bitrate) {
|
estimated_bitrate_bps_ < max_total_allocated_bitrate) {
|
||||||
max_total_allocated_bitrate_ = 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.
|
if (!config_.first_allocation_probe_scale)
|
||||||
return InitiateProbing(
|
return std::vector<ProbeClusterConfig>();
|
||||||
at_time_ms,
|
|
||||||
{max_total_allocated_bitrate, 2 * max_total_allocated_bitrate}, false);
|
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;
|
max_total_allocated_bitrate_ = max_total_allocated_bitrate;
|
||||||
return std::vector<ProbeClusterConfig>();
|
return std::vector<ProbeClusterConfig>();
|
||||||
@ -216,9 +228,9 @@ std::vector<ProbeClusterConfig> ProbeController::InitiateExponentialProbing(
|
|||||||
// When probing at 1.8 Mbps ( 6x 300), this represents a threshold of
|
// When probing at 1.8 Mbps ( 6x 300), this represents a threshold of
|
||||||
// 1.2 Mbps to continue probing.
|
// 1.2 Mbps to continue probing.
|
||||||
std::vector<int64_t> probes = {static_cast<int64_t>(
|
std::vector<int64_t> probes = {static_cast<int64_t>(
|
||||||
config_.first_exponential_probe_scale_ * start_bitrate_bps_)};
|
config_.first_exponential_probe_scale * start_bitrate_bps_)};
|
||||||
if (config_.second_exponential_probe_scale_) {
|
if (config_.second_exponential_probe_scale) {
|
||||||
probes.push_back(config_.second_exponential_probe_scale_.Value() *
|
probes.push_back(config_.second_exponential_probe_scale.Value() *
|
||||||
start_bitrate_bps_);
|
start_bitrate_bps_);
|
||||||
}
|
}
|
||||||
return InitiateProbing(at_time_ms, probes, true);
|
return InitiateProbing(at_time_ms, probes, true);
|
||||||
@ -247,7 +259,7 @@ std::vector<ProbeClusterConfig> ProbeController::SetEstimatedBitrate(
|
|||||||
bitrate_bps > min_bitrate_to_probe_further_bps_) {
|
bitrate_bps > min_bitrate_to_probe_further_bps_) {
|
||||||
pending_probes = InitiateProbing(
|
pending_probes = InitiateProbing(
|
||||||
at_time_ms,
|
at_time_ms,
|
||||||
{static_cast<int64_t>(config_.further_exponential_probe_scale_ *
|
{static_cast<int64_t>(config_.further_exponential_probe_scale *
|
||||||
bitrate_bps)},
|
bitrate_bps)},
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
@ -348,11 +360,11 @@ std::vector<ProbeClusterConfig> ProbeController::Process(int64_t at_time_ms) {
|
|||||||
if (alr_start_time_ms_ && estimated_bitrate_bps_ > 0) {
|
if (alr_start_time_ms_ && estimated_bitrate_bps_ > 0) {
|
||||||
int64_t next_probe_time_ms =
|
int64_t next_probe_time_ms =
|
||||||
std::max(*alr_start_time_ms_, time_last_probing_initiated_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) {
|
if (at_time_ms >= next_probe_time_ms) {
|
||||||
return InitiateProbing(at_time_ms,
|
return InitiateProbing(at_time_ms,
|
||||||
{static_cast<int64_t>(estimated_bitrate_bps_ *
|
{static_cast<int64_t>(estimated_bitrate_bps_ *
|
||||||
config_.alr_probe_scale_)},
|
config_.alr_probe_scale)},
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,14 +39,19 @@ struct ProbeControllerConfig {
|
|||||||
// Then whenever we get a bitrate estimate of at least further_probe_threshold
|
// 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
|
// times the size of the last sent probe we'll send another one of size
|
||||||
// step_size times the new estimate.
|
// step_size times the new estimate.
|
||||||
FieldTrialParameter<double> first_exponential_probe_scale_;
|
FieldTrialParameter<double> first_exponential_probe_scale;
|
||||||
FieldTrialOptional<double> second_exponential_probe_scale_;
|
FieldTrialOptional<double> second_exponential_probe_scale;
|
||||||
FieldTrialParameter<double> further_exponential_probe_scale_;
|
FieldTrialParameter<double> further_exponential_probe_scale;
|
||||||
FieldTrialParameter<double> further_probe_threshold;
|
FieldTrialParameter<double> further_probe_threshold;
|
||||||
|
|
||||||
// Configures how often we send ALR probes and how big they are.
|
// Configures how often we send ALR probes and how big they are.
|
||||||
FieldTrialParameter<TimeDelta> alr_probing_interval_;
|
FieldTrialParameter<TimeDelta> alr_probing_interval;
|
||||||
FieldTrialParameter<double> alr_probe_scale_;
|
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
|
// This class controls initiation of probing to estimate initial channel
|
||||||
|
|||||||
@ -315,11 +315,12 @@ TEST_F(ProbeControllerTest, TestAllocatedBitrateCap) {
|
|||||||
TEST_F(ProbeControllerTest, ConfigurableProbingFieldTrial) {
|
TEST_F(ProbeControllerTest, ConfigurableProbingFieldTrial) {
|
||||||
test::ScopedFieldTrials trials(
|
test::ScopedFieldTrials trials(
|
||||||
"WebRTC-Bwe-ProbingConfiguration/"
|
"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(
|
probe_controller_.reset(
|
||||||
new ProbeController(&field_trial_config_, &mock_rtc_event_log));
|
new ProbeController(&field_trial_config_, &mock_rtc_event_log));
|
||||||
auto probes = probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
auto probes = probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
|
||||||
kMaxBitrateBps, NowMs());
|
5000000, NowMs());
|
||||||
EXPECT_EQ(probes.size(), 2u);
|
EXPECT_EQ(probes.size(), 2u);
|
||||||
EXPECT_EQ(probes[0].target_data_rate.bps(), 600);
|
EXPECT_EQ(probes[0].target_data_rate.bps(), 600);
|
||||||
EXPECT_EQ(probes[1].target_data_rate.bps(), 1500);
|
EXPECT_EQ(probes[1].target_data_rate.bps(), 1500);
|
||||||
@ -332,6 +333,13 @@ TEST_F(ProbeControllerTest, ConfigurableProbingFieldTrial) {
|
|||||||
probes = probe_controller_->SetEstimatedBitrate(1250, NowMs());
|
probes = probe_controller_->SetEstimatedBitrate(1250, NowMs());
|
||||||
EXPECT_EQ(probes.size(), 1u);
|
EXPECT_EQ(probes.size(), 1u);
|
||||||
EXPECT_EQ(probes[0].target_data_rate.bps(), 3 * 1250);
|
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
|
} // namespace test
|
||||||
|
|||||||
Reference in New Issue
Block a user