OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 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_.GetApplicationLimitedRegionStartTime()); | 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_.GetApplicationLimitedRegionStartTime()); | 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 70%. |
65 SimulateOutgoingTraffic(500, 40); | 65 SimulateOutgoingTraffic(500, 69); |
66 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 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 70%. |
69 SimulateOutgoingTraffic(500, 60); | 69 SimulateOutgoingTraffic(500, 75); |
70 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 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_.GetApplicationLimitedRegionStartTime()); | 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_.GetApplicationLimitedRegionStartTime()); | 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_.GetApplicationLimitedRegionStartTime()); | 83 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
84 | 84 |
85 SimulateOutgoingTraffic(200, 20); | 85 SimulateOutgoingTraffic(200, 20); |
86 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 86 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
87 | 87 |
88 // ALR ends when usage is above 50%. | 88 // ALR ends when usage is above 70%. |
89 SimulateOutgoingTraffic(500, 60); | 89 SimulateOutgoingTraffic(500, 75); |
90 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 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_.GetApplicationLimitedRegionStartTime()); | 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_.GetApplicationLimitedRegionStartTime()); | 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_.GetApplicationLimitedRegionStartTime()); | 106 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
107 SimulateOutgoingTraffic(10, 20); | 107 SimulateOutgoingTraffic(10, 20); |
108 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 108 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
109 } | 109 } |
110 | 110 |
111 } // namespace webrtc | 111 } // namespace webrtc |
OLD | NEW |