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 37089bc5ab..484b5681a3 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 @@ -124,6 +124,35 @@ void UpdatesTargetRateBasedOnLinkCapacity(std::string test_name = "") { truth->PrintRow(); EXPECT_NEAR(client->target_rate().kbps(), 90, 25); } + +DataRate RunRembDipScenario(std::string test_name) { + Scenario s(test_name); + NetworkSimulationConfig net_conf; + net_conf.bandwidth = DataRate::KilobitsPerSec(2000); + net_conf.delay = TimeDelta::Millis(50); + auto* client = s.CreateClient("send", [&](CallClientConfig* c) { + c->transport.rates.start_rate = DataRate::KilobitsPerSec(1000); + }); + auto send_net = {s.CreateSimulationNode(net_conf)}; + auto ret_net = {s.CreateSimulationNode(net_conf)}; + auto* route = s.CreateRoutes( + client, send_net, s.CreateClient("return", CallClientConfig()), ret_net); + s.CreateVideoStream(route->forward(), VideoStreamConfig()); + + s.RunFor(TimeDelta::Seconds(10)); + EXPECT_GT(client->send_bandwidth().kbps(), 1500); + + DataRate RembLimit = DataRate::KilobitsPerSec(250); + client->SetRemoteBitrate(RembLimit); + s.RunFor(TimeDelta::Seconds(1)); + EXPECT_EQ(client->send_bandwidth(), RembLimit); + + DataRate RembLimitLifted = DataRate::KilobitsPerSec(10000); + client->SetRemoteBitrate(RembLimitLifted); + s.RunFor(TimeDelta::Seconds(10)); + + return client->send_bandwidth(); +} } // namespace class GoogCcNetworkControllerTest : public ::testing::Test { @@ -851,31 +880,16 @@ TEST_F(GoogCcNetworkControllerTest, IsFairToTCP) { } TEST(GoogCcScenario, RampupOnRembCapLifted) { - Scenario s("googcc_unit/rampup_ramb_cap_lifted"); - NetworkSimulationConfig net_conf; - net_conf.bandwidth = DataRate::KilobitsPerSec(2000); - net_conf.delay = TimeDelta::Millis(50); - auto* client = s.CreateClient("send", [&](CallClientConfig* c) { - c->transport.rates.start_rate = DataRate::KilobitsPerSec(1000); - }); - auto send_net = {s.CreateSimulationNode(net_conf)}; - auto ret_net = {s.CreateSimulationNode(net_conf)}; - auto* route = s.CreateRoutes( - client, send_net, s.CreateClient("return", CallClientConfig()), ret_net); - s.CreateVideoStream(route->forward(), VideoStreamConfig()); + DataRate final_estimate = + RunRembDipScenario("googcc_unit/rampup_ramb_cap_lifted"); + EXPECT_GT(final_estimate.kbps(), 1500); +} - s.RunFor(TimeDelta::Seconds(10)); - EXPECT_GT(client->send_bandwidth().kbps(), 1500); - - DataRate RembLimit = DataRate::KilobitsPerSec(250); - client->SetRemoteBitrate(RembLimit); - s.RunFor(TimeDelta::Seconds(1)); - EXPECT_EQ(client->send_bandwidth(), RembLimit); - - DataRate RembLimitLifted = DataRate::KilobitsPerSec(10000); - client->SetRemoteBitrate(RembLimitLifted); - s.RunFor(TimeDelta::Seconds(10)); - EXPECT_GT(client->send_bandwidth().kbps(), 1500); +TEST(GoogCcScenario, SlowRampupOnRembCapLiftedWithKillSwitch) { + ScopedFieldTrials trial("WebRTC-Bwe-ReceiverLimitCapsOnly/Disabled/"); + DataRate final_estimate = + RunRembDipScenario("googcc_unit/slow_rampup_remb_cap_lifted_killswitch"); + EXPECT_LT(final_estimate.kbps(), 1000); } } // namespace test diff --git a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc index 143e7e4032..a4ee99d753 100644 --- a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc +++ b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc @@ -226,7 +226,8 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation( low_loss_threshold_(kDefaultLowLossThreshold), high_loss_threshold_(kDefaultHighLossThreshold), bitrate_threshold_(kDefaultBitrateThreshold), - loss_based_bandwidth_estimation_(key_value_config) { + loss_based_bandwidth_estimation_(key_value_config), + disable_receiver_limit_caps_only_("Disabled") { RTC_DCHECK(event_log); if (BweLossExperimentIsEnabled()) { uint32_t bitrate_threshold_kbps; @@ -239,6 +240,8 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation( bitrate_threshold_ = DataRate::KilobitsPerSec(bitrate_threshold_kbps); } } + ParseFieldTrial({&disable_receiver_limit_caps_only_}, + key_value_config->Lookup("WebRTC-Bwe-ReceiverLimitCapsOnly")); } SendSideBandwidthEstimation::~SendSideBandwidthEstimation() {} @@ -307,7 +310,9 @@ int SendSideBandwidthEstimation::GetMinBitrate() const { } DataRate SendSideBandwidthEstimation::target_rate() const { - DataRate target = std::min(current_target_, receiver_limit_); + DataRate target = current_target_; + if (!disable_receiver_limit_caps_only_) + target = std::min(target, receiver_limit_); return std::max(min_bitrate_configured_, target); } @@ -579,7 +584,10 @@ void SendSideBandwidthEstimation::UpdateMinHistory(Timestamp at_time) { } DataRate SendSideBandwidthEstimation::GetUpperLimit() const { - return std::min(delay_based_limit_, max_bitrate_configured_); + DataRate upper_limit = delay_based_limit_; + if (disable_receiver_limit_caps_only_) + upper_limit = std::min(upper_limit, receiver_limit_); + return std::min(upper_limit, max_bitrate_configured_); } void SendSideBandwidthEstimation::MaybeLogLowBitrateWarning(DataRate bitrate, diff --git a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h index 05bf10d6ff..8c1e1d04d8 100644 --- a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h +++ b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.h @@ -190,6 +190,7 @@ class SendSideBandwidthEstimation { float high_loss_threshold_; DataRate bitrate_threshold_; LossBasedBandwidthEstimation loss_based_bandwidth_estimation_; + FieldTrialFlag disable_receiver_limit_caps_only_; }; } // namespace webrtc #endif // MODULES_CONGESTION_CONTROLLER_GOOG_CC_SEND_SIDE_BANDWIDTH_ESTIMATION_H_