From aaa99a93e288f0354b03b96588d0624ee910d2ed Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Fri, 11 Jan 2019 13:32:44 +0100 Subject: [PATCH] Add unittest for congestion window pushback in goog_cc. Bug: none Change-Id: Idc4ed71d8e12335eeaccbf1181eff36657f122d0 Reviewed-on: https://webrtc-review.googlesource.com/c/116320 Reviewed-by: Sebastian Jansson Commit-Queue: Ying Wang Cr-Commit-Position: refs/heads/master@{#26222} --- .../goog_cc_network_control_unittest.cc | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) 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 7b4b9b0feb..5b9b7d06aa 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 @@ -210,6 +210,42 @@ TEST_F(GoogCcNetworkControllerTest, ReactsToChangedNetworkConditions) { kInitialBitrate * kDefaultPacingRate); } +// Test congestion window pushback on network delay happens. +TEST_F(GoogCcNetworkControllerTest, CongestionWindowPushbackOnNetworkDelay) { + ScopedFieldTrials trial( + "WebRTC-CongestionWindowPushback/Enabled/WebRTC-CwndExperiment/" + "Enabled-800/"); + Scenario s("googcc_unit/cwnd_on_delay", false); + auto send_net = s.CreateSimulationNode([=](NetworkNodeConfig* c) { + c->simulation.bandwidth = DataRate::kbps(1000); + c->simulation.delay = TimeDelta::ms(100); + c->update_frequency = TimeDelta::ms(5); + }); + auto ret_net = s.CreateSimulationNode([](NetworkNodeConfig* c) { + c->simulation.delay = TimeDelta::ms(100); + c->update_frequency = TimeDelta::ms(5); + }); + SimulatedTimeClientConfig config; + config.transport.cc = + TransportControllerConfig::CongestionController::kGoogCcFeedback; + // Start high so bandwidth drop has max effect. + config.transport.rates.start_rate = DataRate::kbps(300); + config.transport.rates.max_rate = DataRate::kbps(2000); + config.transport.rates.min_rate = DataRate::kbps(10); + SimulatedTimeClient* client = s.CreateSimulatedTimeClient( + "send", config, {PacketStreamConfig()}, {send_net}, {ret_net}); + + s.RunFor(TimeDelta::seconds(10)); + send_net->PauseTransmissionUntil(s.Now() + TimeDelta::seconds(10)); + s.RunFor(TimeDelta::seconds(3)); + + // After 3 seconds without feedback from any sent packets, we expect that the + // target rate is reduced to the minimum pushback threshold + // kDefaultMinPushbackTargetBitrateBps, which is defined as 30 kbps in + // congestion_window_pushback_controller. + EXPECT_LT(client->target_rate_kbps(), 40); +} + TEST_F(GoogCcNetworkControllerTest, OnNetworkRouteChanged) { NetworkControlUpdate update; DataRate new_bitrate = DataRate::bps(200000);