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 #include <memory> | 10 #include <memory> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100, _)); | 77 EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100, _)); |
78 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, | 78 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, |
79 kMaxBitrateBps + 100); | 79 kMaxBitrateBps + 100); |
80 } | 80 } |
81 | 81 |
82 TEST_F(ProbeControllerTest, TestExponentialProbing) { | 82 TEST_F(ProbeControllerTest, TestExponentialProbing) { |
83 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, | 83 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, |
84 kMaxBitrateBps); | 84 kMaxBitrateBps); |
85 | 85 |
86 // Repeated probe should only be sent when estimated bitrate climbs above 4 * | 86 // Repeated probe should only be sent when estimated bitrate climbs above |
87 // kStartBitrateBps = 1200. | 87 // 0.7 * 6 * kStartBitrateBps = 1260. |
88 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(0); | 88 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(0); |
89 probe_controller_->SetEstimatedBitrate(1000); | 89 probe_controller_->SetEstimatedBitrate(1000); |
90 testing::Mock::VerifyAndClearExpectations(&pacer_); | 90 testing::Mock::VerifyAndClearExpectations(&pacer_); |
91 | 91 |
92 EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _)); | 92 EXPECT_CALL(pacer_, CreateProbeCluster(2 * 1800, _)); |
93 probe_controller_->SetEstimatedBitrate(1800); | 93 probe_controller_->SetEstimatedBitrate(1800); |
94 } | 94 } |
95 | 95 |
96 TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) { | 96 TEST_F(ProbeControllerTest, TestExponentialProbingTimeout) { |
97 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, | 97 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(1); | 154 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(1); |
155 EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime()) | 155 EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime()) |
156 .WillRepeatedly(Return(rtc::Optional<int64_t>(start_time))); | 156 .WillRepeatedly(Return(rtc::Optional<int64_t>(start_time))); |
157 clock_.AdvanceTimeMilliseconds(1000); | 157 clock_.AdvanceTimeMilliseconds(1000); |
158 probe_controller_->Process(); | 158 probe_controller_->Process(); |
159 probe_controller_->SetEstimatedBitrate(500); | 159 probe_controller_->SetEstimatedBitrate(500); |
160 testing::Mock::VerifyAndClearExpectations(&pacer_); | 160 testing::Mock::VerifyAndClearExpectations(&pacer_); |
161 } | 161 } |
162 | 162 |
| 163 TEST_F(ProbeControllerTest, TestExponentialProbingOverflow) { |
| 164 int kMbps = 1000000; |
| 165 probe_controller_->SetBitrates(kMinBitrateBps, 10 * kMbps, 100 * kMbps); |
| 166 |
| 167 // Verify that probe bitrate is capped at the specified max bitrate |
| 168 EXPECT_CALL(pacer_, CreateProbeCluster(100 * kMbps, _)); |
| 169 probe_controller_->SetEstimatedBitrate(60 * kMbps); |
| 170 testing::Mock::VerifyAndClearExpectations(&pacer_); |
| 171 |
| 172 // Verify that repeated probes aren't sent. |
| 173 EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(0); |
| 174 probe_controller_->SetEstimatedBitrate(100 * kMbps); |
| 175 } |
| 176 |
163 } // namespace test | 177 } // namespace test |
164 } // namespace webrtc | 178 } // namespace webrtc |
OLD | NEW |