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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _)); | 208 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _)); |
209 controller_->SignalNetworkState(kNetworkDown); | 209 controller_->SignalNetworkState(kNetworkDown); |
210 | 210 |
211 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _, _)); | 211 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _, _)); |
212 controller_->SignalNetworkState(kNetworkUp); | 212 controller_->SignalNetworkState(kNetworkUp); |
213 | 213 |
214 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _)); | 214 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _)); |
215 controller_->SignalNetworkState(kNetworkDown); | 215 controller_->SignalNetworkState(kNetworkDown); |
216 } | 216 } |
217 | 217 |
218 TEST_F(CongestionControllerTest, ResetBweAndBitrates) { | 218 TEST_F(CongestionControllerTest, OnNetworkRouteChanged) { |
219 int new_bitrate = 200000; | 219 int new_bitrate = 200000; |
220 testing::Mock::VerifyAndClearExpectations(pacer_); | 220 testing::Mock::VerifyAndClearExpectations(pacer_); |
221 EXPECT_CALL(observer_, OnNetworkChanged(new_bitrate, _, _, _)); | 221 EXPECT_CALL(observer_, OnNetworkChanged(new_bitrate, _, _, _)); |
222 EXPECT_CALL(*pacer_, SetEstimatedBitrate(new_bitrate)); | 222 EXPECT_CALL(*pacer_, SetEstimatedBitrate(new_bitrate)); |
223 controller_->ResetBweAndBitrates(new_bitrate, -1, -1); | 223 rtc::NetworkRoute route; |
| 224 route.local_network_id = 1; |
| 225 controller_->OnNetworkRouteChanged(route, new_bitrate, -1, -1); |
224 | 226 |
225 // If the bitrate is reset to -1, the new starting bitrate will be | 227 // If the bitrate is reset to -1, the new starting bitrate will be |
226 // the minimum default bitrate kMinBitrateBps. | 228 // the minimum default bitrate kMinBitrateBps. |
227 EXPECT_CALL( | 229 EXPECT_CALL( |
228 observer_, | 230 observer_, |
229 OnNetworkChanged(congestion_controller::GetMinBitrateBps(), _, _, _)); | 231 OnNetworkChanged(congestion_controller::GetMinBitrateBps(), _, _, _)); |
230 EXPECT_CALL(*pacer_, | 232 EXPECT_CALL(*pacer_, |
231 SetEstimatedBitrate(congestion_controller::GetMinBitrateBps())); | 233 SetEstimatedBitrate(congestion_controller::GetMinBitrateBps())); |
232 controller_->ResetBweAndBitrates(-1, -1, -1); | 234 route.local_network_id = 2; |
| 235 controller_->OnNetworkRouteChanged(route, -1, -1, -1); |
233 } | 236 } |
234 | 237 |
235 TEST_F(CongestionControllerTest, | 238 TEST_F(CongestionControllerTest, |
236 SignalNetworkStateAndQueueIsFullAndEstimateChange) { | 239 SignalNetworkStateAndQueueIsFullAndEstimateChange) { |
237 // Send queue is full | 240 // Send queue is full |
238 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) | 241 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) |
239 .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1)); | 242 .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1)); |
240 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _)); | 243 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _)); |
241 controller_->Process(); | 244 controller_->Process(); |
242 | 245 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 clock_.AdvanceTimeMilliseconds((1000 * payload_size) / kInitialBitrateBps); | 312 clock_.AdvanceTimeMilliseconds((1000 * payload_size) / kInitialBitrateBps); |
310 int64_t now_ms = clock_.TimeInMilliseconds(); | 313 int64_t now_ms = clock_.TimeInMilliseconds(); |
311 header.extension.absoluteSendTime = AbsSendTime(now_ms, 1000); | 314 header.extension.absoluteSendTime = AbsSendTime(now_ms, 1000); |
312 controller_->OnReceivedPacket(now_ms, payload_size, header); | 315 controller_->OnReceivedPacket(now_ms, payload_size, header); |
313 } | 316 } |
314 | 317 |
315 ASSERT_EQ(1u, ssrcs.size()); | 318 ASSERT_EQ(1u, ssrcs.size()); |
316 EXPECT_EQ(header.ssrc, ssrcs[0]); | 319 EXPECT_EQ(header.ssrc, ssrcs[0]); |
317 } | 320 } |
318 | 321 |
319 TEST_F(CongestionControllerTest, ProbeOnBweReset) { | 322 TEST_F(CongestionControllerTest, ProbeOnRouteChange) { |
320 testing::Mock::VerifyAndClearExpectations(pacer_); | 323 testing::Mock::VerifyAndClearExpectations(pacer_); |
321 EXPECT_CALL(*pacer_, CreateProbeCluster(kInitialBitrateBps * 6)); | 324 EXPECT_CALL(*pacer_, CreateProbeCluster(kInitialBitrateBps * 6)); |
322 EXPECT_CALL(*pacer_, CreateProbeCluster(kInitialBitrateBps * 12)); | 325 EXPECT_CALL(*pacer_, CreateProbeCluster(kInitialBitrateBps * 12)); |
323 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _, _)); | 326 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _, _)); |
324 controller_->ResetBweAndBitrates(2 * kInitialBitrateBps, 0, | 327 rtc::NetworkRoute route; |
325 20 * kInitialBitrateBps); | 328 route.local_network_id = 1; |
| 329 controller_->OnNetworkRouteChanged(route, 2 * kInitialBitrateBps, 0, |
| 330 20 * kInitialBitrateBps); |
326 } | 331 } |
327 | 332 |
328 // Estimated bitrate reduced when the feedbacks arrive with such a long delay, | 333 // Estimated bitrate reduced when the feedbacks arrive with such a long delay, |
329 // that the send-time-history no longer holds the feedbacked packets. | 334 // that the send-time-history no longer holds the feedbacked packets. |
330 TEST_F(CongestionControllerTest, LongFeedbackDelays) { | 335 TEST_F(CongestionControllerTest, LongFeedbackDelays) { |
331 TargetBitrateTrackingSetup(); | 336 TargetBitrateTrackingSetup(); |
332 | 337 |
333 const int64_t kFeedbackTimeoutMs = 60001; | 338 const int64_t kFeedbackTimeoutMs = 60001; |
334 const int kMaxConsecutiveFailedLookups = 5; | 339 const int kMaxConsecutiveFailedLookups = 5; |
335 for (int i = 0; i < kMaxConsecutiveFailedLookups; ++i) { | 340 for (int i = 0; i < kMaxConsecutiveFailedLookups; ++i) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 ASSERT_TRUE(target_bitrate_bps_); | 436 ASSERT_TRUE(target_bitrate_bps_); |
432 | 437 |
433 // Repeat, but this time with a building delay, and make sure that the | 438 // Repeat, but this time with a building delay, and make sure that the |
434 // estimation is adjusted downwards. | 439 // estimation is adjusted downwards. |
435 uint32_t bitrate_before_delay = *target_bitrate_bps_; | 440 uint32_t bitrate_before_delay = *target_bitrate_bps_; |
436 PacketTransmissionAndFeedbackBlock(&seq_num, kRunTimeMs, 50); | 441 PacketTransmissionAndFeedbackBlock(&seq_num, kRunTimeMs, 50); |
437 EXPECT_LT(*target_bitrate_bps_, bitrate_before_delay); | 442 EXPECT_LT(*target_bitrate_bps_, bitrate_before_delay); |
438 } | 443 } |
439 } // namespace test | 444 } // namespace test |
440 } // namespace webrtc | 445 } // namespace webrtc |
OLD | NEW |