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

Unified Diff: webrtc/modules/pacing/alr_detector_unittest.cc

Issue 2965233002: Let alr dectector use a budged to detect underuse. (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/pacing/alr_detector_unittest.cc
diff --git a/webrtc/modules/pacing/alr_detector_unittest.cc b/webrtc/modules/pacing/alr_detector_unittest.cc
index 3c912772235a13b94b705de1f1cb2e2855e50089..dd8ea40689fa35dcb94a2531381f54d15735d331 100644
--- a/webrtc/modules/pacing/alr_detector_unittest.cc
+++ b/webrtc/modules/pacing/alr_detector_unittest.cc
@@ -29,24 +29,20 @@ class AlrDetectorTest : public testing::Test {
void SimulateOutgoingTraffic(int interval_ms, int usage_percentage) {
const int kTimeStepMs = 10;
for (int t = 0; t < interval_ms; t += kTimeStepMs) {
- now_ms += kTimeStepMs;
alr_detector_.OnBytesSent(kEstimatedBitrateBps * usage_percentage *
kTimeStepMs / (8 * 100 * 1000),
- now_ms);
+ kTimeStepMs);
}
-
int remainder_ms = interval_ms % kTimeStepMs;
- now_ms += remainder_ms;
if (remainder_ms > 0) {
alr_detector_.OnBytesSent(kEstimatedBitrateBps * usage_percentage *
remainder_ms / (8 * 100 * 1000),
- remainder_ms);
+ kTimeStepMs);
}
}
protected:
AlrDetector alr_detector_;
- int64_t now_ms = 1;
};
TEST_F(AlrDetectorTest, AlrDetection) {
@@ -54,19 +50,15 @@ TEST_F(AlrDetectorTest, AlrDetection) {
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
// Stay in non-ALR state when usage is close to 100%.
- SimulateOutgoingTraffic(500, 90);
+ SimulateOutgoingTraffic(1000, 90);
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
// Verify that we ALR starts when bitrate drops below 20%.
- SimulateOutgoingTraffic(500, 20);
- EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
-
- // Verify that we remain in ALR state while usage is still below 70%.
- SimulateOutgoingTraffic(500, 69);
+ SimulateOutgoingTraffic(1000, 20);
EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
- // Verify that ALR ends when usage is above 70%.
- SimulateOutgoingTraffic(500, 75);
+ // Verify that ALR ends when usage is above 60%.
stefan-webrtc 2017/07/06 14:55:38 Not clear how for instance 60% relates to 1000, 10
tschumi 2017/07/07 08:47:30 Changed the impl a little so that the test code sh
+ SimulateOutgoingTraffic(1000, 100);
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
}
@@ -75,18 +67,15 @@ TEST_F(AlrDetectorTest, ShortSpike) {
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
// Verify that we ALR starts when bitrate drops below 20%.
- SimulateOutgoingTraffic(500, 20);
+ SimulateOutgoingTraffic(1000, 20);
EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
// Verify that we stay in ALR region even after a short bitrate spike.
- SimulateOutgoingTraffic(100, 150);
- EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
-
- SimulateOutgoingTraffic(200, 20);
+ SimulateOutgoingTraffic(200, 150);
EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
- // ALR ends when usage is above 70%.
- SimulateOutgoingTraffic(500, 75);
+ // ALR ends when usage is above 100%.
stefan-webrtc 2017/07/06 14:55:38 Do we want to change from 70% to 100%?
tschumi 2017/07/07 08:47:30 Yea my mistake => changed it to 65 % (new default
+ SimulateOutgoingTraffic(1000, 100);
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
}
@@ -95,7 +84,7 @@ TEST_F(AlrDetectorTest, BandwidthEstimateChanges) {
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
// ALR starts when bitrate drops below 20%.
stefan-webrtc 2017/07/06 14:55:37 Is this comment still correct? Why did it change f
tschumi 2017/07/07 08:47:30 Because of the new impl. it takes more time to det
- SimulateOutgoingTraffic(500, 20);
+ SimulateOutgoingTraffic(1000, 20);
EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
// When bandwidth estimate drops the detector should stay in ALR mode and quit
@@ -104,7 +93,7 @@ TEST_F(AlrDetectorTest, BandwidthEstimateChanges) {
// to the BWE drop by initiating a new probe.
alr_detector_.SetEstimatedBitrate(kEstimatedBitrateBps / 5);
EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
- SimulateOutgoingTraffic(10, 20);
+ SimulateOutgoingTraffic(1000, 50);
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
}

Powered by Google App Engine
This is Rietveld 408576698