diff --git a/modules/congestion_controller/goog_cc/probe_controller.cc b/modules/congestion_controller/goog_cc/probe_controller.cc index 0dfb8a3ad4..501f14b874 100644 --- a/modules/congestion_controller/goog_cc/probe_controller.cc +++ b/modules/congestion_controller/goog_cc/probe_controller.cc @@ -376,6 +376,7 @@ void ProbeController::SetNetworkStateEstimate( send_probe_on_next_process_interval_ = true; } if (config_.network_state_estimate_drop_down_rate > 0 && network_estimate_ && + !estimate.link_capacity_upper.IsZero() && (estimated_bitrate_ > estimate.link_capacity_upper || bwe_limited_due_to_packet_loss_) && estimate.link_capacity_upper <= @@ -470,8 +471,11 @@ std::vector ProbeController::InitiateProbing( max_probe_bitrate = std::min(estimated_bitrate_, max_bitrate_); } if (config_.network_state_estimate_probing_interval->IsFinite() && - network_estimate_ && - network_estimate_->link_capacity_upper > DataRate::Zero()) { + network_estimate_ && network_estimate_->link_capacity_upper.IsFinite()) { + if (network_estimate_->link_capacity_upper.IsZero()) { + RTC_LOG(LS_INFO) << "Not sending probe, Network state estimate is zero"; + return {}; + } max_probe_bitrate = std::min(max_probe_bitrate, network_estimate_->link_capacity_upper * config_.network_state_probe_scale); diff --git a/modules/congestion_controller/goog_cc/probe_controller_unittest.cc b/modules/congestion_controller/goog_cc/probe_controller_unittest.cc index 06ec68196e..2b2d71205e 100644 --- a/modules/congestion_controller/goog_cc/probe_controller_unittest.cc +++ b/modules/congestion_controller/goog_cc/probe_controller_unittest.cc @@ -909,5 +909,32 @@ TEST(ProbeControllerTest, SendsProbeIfNetworkStateEstimateLowerThanMaxProbe) { EXPECT_FALSE(probes.empty()); } +TEST(ProbeControllerTest, DontSendProbeIfNetworkStateEstimateIsZero) { + ProbeControllerFixture fixture( + "WebRTC-Bwe-ProbingConfiguration/" + "network_state_interval:5s,network_state_drop_down_rate:0.5,limit_probe_" + "target_rate_to_loss_bwe:true/"); + std::unique_ptr probe_controller = + fixture.CreateController(); + auto probes = probe_controller->SetBitrates( + kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime()); + probes = probe_controller->SetEstimatedBitrate( + kStartBitrate, /*bwe_limited_due_to_packet_loss=*/false, + fixture.CurrentTime()); + probe_controller->SetNetworkStateEstimate( + {.link_capacity_upper = kStartBitrate}); + // Need to wait at least one second before process can trigger a new probe. + fixture.AdvanceTime(TimeDelta::Millis(1100)); + probes = probe_controller->Process(fixture.CurrentTime()); + ASSERT_TRUE(probes.empty()); + + probe_controller->SetNetworkStateEstimate( + {.link_capacity_upper = DataRate::Zero()}); + probes = probe_controller->Process(fixture.CurrentTime()); + EXPECT_TRUE(probes.empty()); + fixture.AdvanceTime(TimeDelta::Seconds(6)); + probes = probe_controller->Process(fixture.CurrentTime()); + EXPECT_TRUE(probes.empty()); +} } // namespace test } // namespace webrtc