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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Long enough to time out exponential probing. | 72 // Long enough to time out exponential probing. |
73 clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs); | 73 clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs); |
74 probe_controller_->SetEstimatedBitrate(kStartBitrateBps); | 74 probe_controller_->SetEstimatedBitrate(kStartBitrateBps); |
75 probe_controller_->Process(); | 75 probe_controller_->Process(); |
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, InitiatesProbingOnMaxBitrateIncreaseAtMaxBitrate) { |
| 83 EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(AtLeast(2)); |
| 84 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, |
| 85 kMaxBitrateBps); |
| 86 // Long enough to time out exponential probing. |
| 87 clock_.AdvanceTimeMilliseconds(kExponentialProbingTimeoutMs); |
| 88 probe_controller_->SetEstimatedBitrate(kStartBitrateBps); |
| 89 probe_controller_->Process(); |
| 90 |
| 91 probe_controller_->SetEstimatedBitrate(kMaxBitrateBps); |
| 92 EXPECT_CALL(pacer_, CreateProbeCluster(kMaxBitrateBps + 100)); |
| 93 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, |
| 94 kMaxBitrateBps + 100); |
| 95 } |
| 96 |
82 TEST_F(ProbeControllerTest, TestExponentialProbing) { | 97 TEST_F(ProbeControllerTest, TestExponentialProbing) { |
83 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, | 98 probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps, |
84 kMaxBitrateBps); | 99 kMaxBitrateBps); |
85 | 100 |
86 // Repeated probe should only be sent when estimated bitrate climbs above | 101 // Repeated probe should only be sent when estimated bitrate climbs above |
87 // 0.7 * 6 * kStartBitrateBps = 1260. | 102 // 0.7 * 6 * kStartBitrateBps = 1260. |
88 EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0); | 103 EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0); |
89 probe_controller_->SetEstimatedBitrate(1000); | 104 probe_controller_->SetEstimatedBitrate(1000); |
90 testing::Mock::VerifyAndClearExpectations(&pacer_); | 105 testing::Mock::VerifyAndClearExpectations(&pacer_); |
91 | 106 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 probe_controller_->SetEstimatedBitrate(60 * kMbpsMultiplier); | 185 probe_controller_->SetEstimatedBitrate(60 * kMbpsMultiplier); |
171 testing::Mock::VerifyAndClearExpectations(&pacer_); | 186 testing::Mock::VerifyAndClearExpectations(&pacer_); |
172 | 187 |
173 // Verify that repeated probes aren't sent. | 188 // Verify that repeated probes aren't sent. |
174 EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0); | 189 EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0); |
175 probe_controller_->SetEstimatedBitrate(100 * kMbpsMultiplier); | 190 probe_controller_->SetEstimatedBitrate(100 * kMbpsMultiplier); |
176 } | 191 } |
177 | 192 |
178 } // namespace test | 193 } // namespace test |
179 } // namespace webrtc | 194 } // namespace webrtc |
OLD | NEW |