Add bandwidth floor for RTT based backoff.

Bug: webrtc:10368
Change-Id: I341a1e0b5a84c03b323e6051a1c2d56feb90867d
Reviewed-on: https://webrtc-review.googlesource.com/c/124990
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Christoffer Rodbro <crodbro@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26905}
This commit is contained in:
Christoffer Rodbro 2019-02-28 15:15:35 +01:00 committed by Commit Bot
parent 3cdd4d5747
commit 8ea0238c7b
3 changed files with 15 additions and 10 deletions

View File

@ -152,14 +152,16 @@ RttBasedBackoff::RttBasedBackoff()
drop_interval_("interval", TimeDelta::ms(300)),
persist_on_route_change_("persist"),
safe_timeout_("safe_timeout", true),
bandwidth_floor_("floor", DataRate::kbps(5)),
// By initializing this to plus infinity, we make sure that we never
// trigger rtt backoff unless packet feedback is enabled.
last_propagation_rtt_update_(Timestamp::PlusInfinity()),
last_propagation_rtt_(TimeDelta::Zero()),
last_packet_sent_(Timestamp::MinusInfinity()) {
ParseFieldTrial({&rtt_limit_, &drop_fraction_, &drop_interval_,
&persist_on_route_change_, &safe_timeout_},
field_trial::FindFullName("WebRTC-Bwe-MaxRttLimit"));
ParseFieldTrial(
{&rtt_limit_, &drop_fraction_, &drop_interval_, &persist_on_route_change_,
&safe_timeout_, &bandwidth_floor_},
field_trial::FindFullName("WebRTC-Bwe-MaxRttLimit"));
}
void RttBasedBackoff::OnRouteChange() {
@ -441,9 +443,11 @@ void SendSideBandwidthEstimation::UpdateRtt(TimeDelta rtt, Timestamp at_time) {
void SendSideBandwidthEstimation::UpdateEstimate(Timestamp at_time) {
DataRate new_bitrate = current_bitrate_;
if (rtt_backoff_.CorrectedRtt(at_time) > rtt_backoff_.rtt_limit_) {
if (at_time - time_last_decrease_ >= rtt_backoff_.drop_interval_) {
if (at_time - time_last_decrease_ >= rtt_backoff_.drop_interval_ &&
current_bitrate_ > rtt_backoff_.bandwidth_floor_) {
time_last_decrease_ = at_time;
new_bitrate = current_bitrate_ * rtt_backoff_.drop_fraction_;
new_bitrate = std::max(current_bitrate_ * rtt_backoff_.drop_fraction_,
rtt_backoff_.bandwidth_floor_.Get());
link_capacity_.OnRttBackoff(new_bitrate, at_time);
}
CapBitrateToThresholds(at_time, new_bitrate);

View File

@ -60,6 +60,7 @@ class RttBasedBackoff {
FieldTrialParameter<TimeDelta> drop_interval_;
FieldTrialFlag persist_on_route_change_;
FieldTrialParameter<bool> safe_timeout_;
FieldTrialParameter<DataRate> bandwidth_floor_;
public:
Timestamp last_propagation_rtt_update_;

View File

@ -336,17 +336,18 @@ TEST_F(GoogCcNetworkControllerTest,
EXPECT_NEAR(client->padding_rate().kbps(), client->target_rate_kbps(), 1);
}
TEST_F(GoogCcNetworkControllerTest, LimitsToMinRateIfRttIsHighInTrial) {
TEST_F(GoogCcNetworkControllerTest, LimitsToFloorIfRttIsHighInTrial) {
// The field trial limits maximum RTT to 2 seconds, higher RTT means that the
// controller backs off until it reaches the minimum configured bitrate. This
// allows the RTT to recover faster than the regular control mechanism would
// achieve.
ScopedFieldTrials trial("WebRTC-Bwe-MaxRttLimit/limit:2s/");
const DataRate kBandwidthFloor = DataRate::kbps(50);
ScopedFieldTrials trial("WebRTC-Bwe-MaxRttLimit/limit:2s,floor:" +
std::to_string(kBandwidthFloor.kbps()) + "kbps/");
// In the test case, we limit the capacity and add a cross traffic packet
// burst that blocks media from being sent. This causes the RTT to quickly
// increase above the threshold in the trial.
const DataRate kLinkCapacity = DataRate::kbps(100);
const DataRate kMinRate = DataRate::kbps(20);
const TimeDelta kBufferBloatDuration = TimeDelta::seconds(10);
Scenario s("googcc_unit/limit_trial", false);
NetworkNodeConfig net_conf;
@ -362,7 +363,6 @@ TEST_F(GoogCcNetworkControllerTest, LimitsToMinRateIfRttIsHighInTrial) {
SimulatedTimeClientConfig config;
config.transport.cc =
TransportControllerConfig::CongestionController::kGoogCc;
config.transport.rates.min_rate = kMinRate;
config.transport.rates.start_rate = kLinkCapacity;
SimulatedTimeClient* client = s.CreateSimulatedTimeClient(
"send", config, {PacketStreamConfig()}, {send_net}, {ret_net});
@ -376,7 +376,7 @@ TEST_F(GoogCcNetworkControllerTest, LimitsToMinRateIfRttIsHighInTrial) {
// Wait to allow the high RTT to be detected and acted upon.
s.RunFor(TimeDelta::seconds(4));
// By now the target rate should have dropped to the minimum configured rate.
EXPECT_NEAR(client->target_rate_kbps(), kMinRate.kbps(), 1);
EXPECT_NEAR(client->target_rate_kbps(), kBandwidthFloor.kbps(), 1);
}
TEST_F(GoogCcNetworkControllerTest, UpdatesTargetRateBasedOnLinkCapacity) {