diff --git a/webrtc/modules/congestion_controller/congestion_controller.cc b/webrtc/modules/congestion_controller/congestion_controller.cc index 68c306ce10..24bfd78887 100644 --- a/webrtc/modules/congestion_controller/congestion_controller.cc +++ b/webrtc/modules/congestion_controller/congestion_controller.cc @@ -172,6 +172,7 @@ CongestionController::CongestionController( transport_feedback_adapter_(bitrate_controller_.get(), clock_), min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), max_bitrate_bps_(0), + initial_probing_triggered_(false), last_reported_bitrate_bps_(0), last_reported_fraction_loss_(0), last_reported_rtt_(0), @@ -202,6 +203,7 @@ CongestionController::CongestionController( transport_feedback_adapter_(bitrate_controller_.get(), clock_), min_bitrate_bps_(RemoteBitrateEstimator::kDefaultMinBitrateBps), max_bitrate_bps_(0), + initial_probing_triggered_(false), last_reported_bitrate_bps_(0), last_reported_fraction_loss_(0), last_reported_rtt_(0), @@ -216,8 +218,6 @@ void CongestionController::Init() { new DelayBasedBwe(&transport_feedback_adapter_, clock_)); transport_feedback_adapter_.GetBitrateEstimator()->SetMinBitrate( min_bitrate_bps_); - pacer_->CreateProbeCluster(900000, 6); - pacer_->CreateProbeCluster(1800000, 5); } void CongestionController::SetBweBitrates(int min_bitrate_bps, @@ -229,12 +229,18 @@ void CongestionController::SetBweBitrates(int min_bitrate_bps, max_bitrate_bps); { + rtc::CritScope cs(&critsect_); + if (!initial_probing_triggered_) { + pacer_->CreateProbeCluster(start_bitrate_bps * 3, 6); + pacer_->CreateProbeCluster(start_bitrate_bps * 6, 5); + initial_probing_triggered_ = true; + } + // Only do probing if: // - we are mid-call, which we consider to be if // |last_reported_bitrate_bps_| != 0, and // - the current bitrate is lower than the new |max_bitrate_bps|, and // - we actually want to increase the |max_bitrate_bps_|. - rtc::CritScope cs(&critsect_); if (last_reported_bitrate_bps_ != 0 && last_reported_bitrate_bps_ < static_cast(max_bitrate_bps) && max_bitrate_bps > max_bitrate_bps_) { diff --git a/webrtc/modules/congestion_controller/include/congestion_controller.h b/webrtc/modules/congestion_controller/include/congestion_controller.h index b70899d84b..57c2c64ff4 100644 --- a/webrtc/modules/congestion_controller/include/congestion_controller.h +++ b/webrtc/modules/congestion_controller/include/congestion_controller.h @@ -125,6 +125,7 @@ class CongestionController : public CallStatsObserver, public Module { TransportFeedbackAdapter transport_feedback_adapter_; int min_bitrate_bps_; int max_bitrate_bps_; + bool initial_probing_triggered_; rtc::CriticalSection critsect_; uint32_t last_reported_bitrate_bps_ GUARDED_BY(critsect_); uint8_t last_reported_fraction_loss_ GUARDED_BY(critsect_); diff --git a/webrtc/modules/congestion_controller/probe_bitrate_estimator.cc b/webrtc/modules/congestion_controller/probe_bitrate_estimator.cc index e8bcfbd984..c69bd1a429 100644 --- a/webrtc/modules/congestion_controller/probe_bitrate_estimator.cc +++ b/webrtc/modules/congestion_controller/probe_bitrate_estimator.cc @@ -20,7 +20,7 @@ namespace { constexpr int kMinNumProbesValidCluster = 4; // The maximum (receive rate)/(send rate) ratio for a valid estimate. -constexpr float kValidRatio = 1.2f; +constexpr float kValidRatio = 2.0f; // The maximum time period over which the cluster history is retained. // This is also the maximum time period beyond which a probing burst is not diff --git a/webrtc/modules/congestion_controller/probe_bitrate_estimator_unittest.cc b/webrtc/modules/congestion_controller/probe_bitrate_estimator_unittest.cc index 0c143b5efd..e4ec739e18 100644 --- a/webrtc/modules/congestion_controller/probe_bitrate_estimator_unittest.cc +++ b/webrtc/modules/congestion_controller/probe_bitrate_estimator_unittest.cc @@ -60,9 +60,9 @@ TEST_F(TestProbeBitrateEstimator, FastReceive) { TEST_F(TestProbeBitrateEstimator, TooFastReceive) { AddPacketFeedback(0, 1000, 0, 19); - AddPacketFeedback(0, 1000, 10, 30); - AddPacketFeedback(0, 1000, 20, 40); - AddPacketFeedback(0, 1000, 40, 50); + AddPacketFeedback(0, 1000, 10, 22); + AddPacketFeedback(0, 1000, 20, 25); + AddPacketFeedback(0, 1000, 40, 27); EXPECT_EQ(measured_bps_, INVALID_BPS); }