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

Side by Side Diff: webrtc/modules/pacing/alr_detector_unittest.cc

Issue 2504023002: Implement periodic bandwidth probing in application-limited region. (Closed)
Patch Set: address feedback Created 4 years 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 unified diff | Download patch
« no previous file with comments | « webrtc/modules/pacing/alr_detector.cc ('k') | webrtc/modules/pacing/mock/mock_paced_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 } 45 }
46 46
47 protected: 47 protected:
48 AlrDetector alr_detector_; 48 AlrDetector alr_detector_;
49 int64_t now_ms = 1; 49 int64_t now_ms = 1;
50 }; 50 };
51 51
52 TEST_F(AlrDetectorTest, AlrDetection) { 52 TEST_F(AlrDetectorTest, AlrDetection) {
53 // Start in non-ALR state. 53 // Start in non-ALR state.
54 EXPECT_FALSE(alr_detector_.InApplicationLimitedRegion()); 54 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
55 55
56 // Stay in non-ALR state when usage is close to 100%. 56 // Stay in non-ALR state when usage is close to 100%.
57 SimulateOutgoingTraffic(500, 90); 57 SimulateOutgoingTraffic(500, 90);
58 EXPECT_FALSE(alr_detector_.InApplicationLimitedRegion()); 58 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
59 59
60 // Verify that we ALR starts when bitrate drops below 20%. 60 // Verify that we ALR starts when bitrate drops below 20%.
61 SimulateOutgoingTraffic(500, 20); 61 SimulateOutgoingTraffic(500, 20);
62 EXPECT_TRUE(alr_detector_.InApplicationLimitedRegion()); 62 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
63 63
64 // Verify that we remain in ALR state while usage is still below 50%. 64 // Verify that we remain in ALR state while usage is still below 50%.
65 SimulateOutgoingTraffic(500, 40); 65 SimulateOutgoingTraffic(500, 40);
66 EXPECT_TRUE(alr_detector_.InApplicationLimitedRegion()); 66 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
67 67
68 // Verify that ALR ends when usage is above 50%. 68 // Verify that ALR ends when usage is above 50%.
69 SimulateOutgoingTraffic(500, 60); 69 SimulateOutgoingTraffic(500, 60);
70 EXPECT_FALSE(alr_detector_.InApplicationLimitedRegion()); 70 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
71 } 71 }
72 72
73 TEST_F(AlrDetectorTest, ShortSpike) { 73 TEST_F(AlrDetectorTest, ShortSpike) {
74 // Start in non-ALR state. 74 // Start in non-ALR state.
75 EXPECT_FALSE(alr_detector_.InApplicationLimitedRegion()); 75 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
76 76
77 // Verify that we ALR starts when bitrate drops below 20%. 77 // Verify that we ALR starts when bitrate drops below 20%.
78 SimulateOutgoingTraffic(500, 20); 78 SimulateOutgoingTraffic(500, 20);
79 EXPECT_TRUE(alr_detector_.InApplicationLimitedRegion()); 79 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
80 80
81 // Verify that we stay in ALR region even after a short bitrate spike. 81 // Verify that we stay in ALR region even after a short bitrate spike.
82 SimulateOutgoingTraffic(100, 150); 82 SimulateOutgoingTraffic(100, 150);
83 EXPECT_TRUE(alr_detector_.InApplicationLimitedRegion()); 83 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
84 84
85 SimulateOutgoingTraffic(200, 20); 85 SimulateOutgoingTraffic(200, 20);
86 EXPECT_TRUE(alr_detector_.InApplicationLimitedRegion()); 86 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
87 87
88 // ALR ends when usage is above 50%. 88 // ALR ends when usage is above 50%.
89 SimulateOutgoingTraffic(500, 60); 89 SimulateOutgoingTraffic(500, 60);
90 EXPECT_FALSE(alr_detector_.InApplicationLimitedRegion()); 90 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
91 } 91 }
92 92
93 TEST_F(AlrDetectorTest, BandwidthEstimateChanges) { 93 TEST_F(AlrDetectorTest, BandwidthEstimateChanges) {
94 // Start in non-ALR state. 94 // Start in non-ALR state.
95 EXPECT_FALSE(alr_detector_.InApplicationLimitedRegion()); 95 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
96 96
97 // ALR starts when bitrate drops below 20%. 97 // ALR starts when bitrate drops below 20%.
98 SimulateOutgoingTraffic(500, 20); 98 SimulateOutgoingTraffic(500, 20);
99 EXPECT_TRUE(alr_detector_.InApplicationLimitedRegion()); 99 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
100 100
101 // When bandwidth estimate drops the detector should stay in ALR mode and quit 101 // When bandwidth estimate drops the detector should stay in ALR mode and quit
102 // it shortly afterwards as the sender continues sending the same amount of 102 // it shortly afterwards as the sender continues sending the same amount of
103 // traffic. This is necessary to ensure that ProbeController can still react 103 // traffic. This is necessary to ensure that ProbeController can still react
104 // to the BWE drop by initiating a new probe. 104 // to the BWE drop by initiating a new probe.
105 alr_detector_.SetEstimatedBitrate(kEstimatedBitrateBps / 5); 105 alr_detector_.SetEstimatedBitrate(kEstimatedBitrateBps / 5);
106 EXPECT_TRUE(alr_detector_.InApplicationLimitedRegion()); 106 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime());
107 SimulateOutgoingTraffic(10, 20); 107 SimulateOutgoingTraffic(10, 20);
108 EXPECT_FALSE(alr_detector_.InApplicationLimitedRegion()); 108 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
109 } 109 }
110 110
111 } // namespace webrtc 111 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/alr_detector.cc ('k') | webrtc/modules/pacing/mock/mock_paced_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698