From 0ef117e14c132429b6889666610b1b24a5b371ff Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Fri, 25 Jan 2019 14:10:31 +0100 Subject: [PATCH] Improving robustness of stable bandwidth estimate test. It didn't have proper time to stabilize, making it sensitive to small changes. This CL increases the stabilization period from 20 to 30s. Also fixing some minor test suite bug found during investigation. Bug: webrtc:9718 Change-Id: If56dba5383251ad3d3efe304eebcd880522afabe Reviewed-on: https://webrtc-review.googlesource.com/c/119943 Reviewed-by: Christoffer Rodbro Commit-Queue: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#26408} --- .../congestion_controller/goog_cc/goog_cc_network_control.cc | 4 +++- .../goog_cc/goog_cc_network_control_unittest.cc | 2 +- modules/congestion_controller/goog_cc/test/goog_cc_printer.cc | 2 +- test/scenario/scenario.cc | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc index 9c82b70e78..226c4f0f7f 100644 --- a/modules/congestion_controller/goog_cc/goog_cc_network_control.cc +++ b/modules/congestion_controller/goog_cc/goog_cc_network_control.cc @@ -574,7 +574,9 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback( NetworkControlUpdate GoogCcNetworkController::GetNetworkState( Timestamp at_time) const { - DataRate bandwidth = DataRate::bps(last_estimated_bitrate_bps_); + DataRate bandwidth = use_stable_bandwidth_estimate_ + ? bandwidth_estimation_->GetEstimatedLinkCapacity() + : last_raw_target_rate_; TimeDelta rtt = TimeDelta::ms(last_estimated_rtt_ms_); NetworkControlUpdate update; update.target_rate = TargetTransferRate(); 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 56600b3774..646e73f819 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 @@ -426,7 +426,7 @@ TEST_F(GoogCcNetworkControllerTest, StableEstimateDoesNotVaryInSteadyState) { SimulatedTimeClient* client = s.CreateSimulatedTimeClient( "send", config, {PacketStreamConfig()}, {send_net}, {ret_net}); // Run for a while to allow the estimate to stabilize. - s.RunFor(TimeDelta::seconds(20)); + s.RunFor(TimeDelta::seconds(30)); DataRate min_estimate = DataRate::PlusInfinity(); DataRate max_estimate = DataRate::MinusInfinity(); // Measure variation in steady state. diff --git a/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc b/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc index c67f7e4623..aba3cec62c 100644 --- a/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc +++ b/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc @@ -33,7 +33,7 @@ bool GoogCcStatePrinter::Attached() const { void GoogCcStatePrinter::PrintHeaders(RtcEventLogOutput* out) { out->Write( - "rate_control_state rate_control_region alr_state" + "rate_control_state stable_estimate alr_state" " trendline trendline_modified_offset trendline_offset_threshold"); } diff --git a/test/scenario/scenario.cc b/test/scenario/scenario.cc index 49125a0d72..3bce243787 100644 --- a/test/scenario/scenario.cc +++ b/test/scenario/scenario.cc @@ -371,7 +371,7 @@ void Scenario::RunUntil(TimeDelta max_duration, sim_clock_.AdvanceTimeMicroseconds(wait_time.us()); // The fake clock is quite slow to update, we only update it if logging is // turned on to save time. - if (!log_writer_factory_) + if (log_writer_factory_) event_log_fake_clock_.SetTimeNanos(sim_clock_.TimeInMicroseconds() * 1000); }