Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1887)

Unified Diff: webrtc/modules/congestion_controller/probe_controller_unittest.cc

Issue 2986563002: Add probing to recover faster from large bitrate drops. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/congestion_controller/probe_controller_unittest.cc
diff --git a/webrtc/modules/congestion_controller/probe_controller_unittest.cc b/webrtc/modules/congestion_controller/probe_controller_unittest.cc
index 9fc0f5508849869ad2b2ad57ea0fbc3eb2f262a4..fc90b61badfaaf8746ec47d27eec2d9a8f923a0b 100644
--- a/webrtc/modules/congestion_controller/probe_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/probe_controller_unittest.cc
@@ -34,6 +34,8 @@ constexpr int kExponentialProbingTimeoutMs = 5000;
constexpr int kAlrProbeInterval = 5000;
+constexpr int kAlrEndedTimeoutMs = 3000;
+
} // namespace
class ProbeControllerTest : public ::testing::Test {
@@ -120,22 +122,48 @@ TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) {
probe_controller_->SetEstimatedBitrate(1800);
}
-TEST_F(ProbeControllerTest, ProbeAfterEstimateDropInAlr) {
+TEST_F(ProbeControllerTest, RequestProbeInAlr) {
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(2);
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
kMaxBitrateBps);
- probe_controller_->SetEstimatedBitrate(500);
testing::Mock::VerifyAndClearExpectations(&pacer_);
-
- // When bandwidth estimate drops the controller should send a probe at the
- // previous bitrate.
EXPECT_CALL(pacer_, CreateProbeCluster(500)).Times(1);
EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime())
.WillRepeatedly(
Return(rtc::Optional<int64_t>(clock_.TimeInMilliseconds())));
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
probe_controller_->Process();
- probe_controller_->SetEstimatedBitrate(50);
+ probe_controller_->RequestProbe(500);
+}
+
+TEST_F(ProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
+ EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(2);
+ probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
+ kMaxBitrateBps);
+ testing::Mock::VerifyAndClearExpectations(&pacer_);
+ EXPECT_CALL(pacer_, CreateProbeCluster(500)).Times(1);
+ EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime())
+ .WillRepeatedly(Return(rtc::Optional<int64_t>()));
+ clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
+ probe_controller_->Process();
+ probe_controller_->SetAlrEndedTimeMs(clock_.TimeInMilliseconds());
+ clock_.AdvanceTimeMilliseconds(kAlrEndedTimeoutMs - 1);
+ probe_controller_->RequestProbe(500);
+}
+
+TEST_F(ProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
+ EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(2);
+ probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
+ kMaxBitrateBps);
+ testing::Mock::VerifyAndClearExpectations(&pacer_);
+ EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0);
+ EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime())
+ .WillRepeatedly(Return(rtc::Optional<int64_t>()));
+ clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
+ probe_controller_->Process();
+ probe_controller_->SetAlrEndedTimeMs(clock_.TimeInMilliseconds());
+ clock_.AdvanceTimeMilliseconds(kAlrEndedTimeoutMs + 1);
+ probe_controller_->RequestProbe(500);
}
TEST_F(ProbeControllerTest, PeriodicProbing) {

Powered by Google App Engine
This is Rietveld 408576698