diff --git a/modules/bitrate_controller/send_side_bandwidth_estimation.cc b/modules/bitrate_controller/send_side_bandwidth_estimation.cc index 5b3591d304..0764ee37ac 100644 --- a/modules/bitrate_controller/send_side_bandwidth_estimation.cc +++ b/modules/bitrate_controller/send_side_bandwidth_estimation.cc @@ -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); diff --git a/modules/bitrate_controller/send_side_bandwidth_estimation.h b/modules/bitrate_controller/send_side_bandwidth_estimation.h index 63b9cb820c..bf740bc971 100644 --- a/modules/bitrate_controller/send_side_bandwidth_estimation.h +++ b/modules/bitrate_controller/send_side_bandwidth_estimation.h @@ -60,6 +60,7 @@ class RttBasedBackoff { FieldTrialParameter drop_interval_; FieldTrialFlag persist_on_route_change_; FieldTrialParameter safe_timeout_; + FieldTrialParameter bandwidth_floor_; public: Timestamp last_propagation_rtt_update_; diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc index a8dd865f38..c41ae8fdee 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control_unittest.cc @@ -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) {