OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 report_blocks.clear(); | 426 report_blocks.clear(); |
427 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; | 427 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
428 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); | 428 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
429 clock_.AdvanceTimeMilliseconds(1500); | 429 clock_.AdvanceTimeMilliseconds(1500); |
430 | 430 |
431 report_blocks.push_back(CreateReportBlock(1, 2, 0, 41)); | 431 report_blocks.push_back(CreateReportBlock(1, 2, 0, 41)); |
432 bandwidth_observer_->OnReceivedRtcpReceiverReport( | 432 bandwidth_observer_->OnReceivedRtcpReceiverReport( |
433 report_blocks, 50, clock_.TimeInMilliseconds()); | 433 report_blocks, 50, clock_.TimeInMilliseconds()); |
434 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; | 434 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
435 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); | 435 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
436 clock_.AdvanceTimeMilliseconds(1000); | 436 clock_.AdvanceTimeMilliseconds(4000); |
437 | 437 |
438 // 1 seconds since feedback, expect increase. | 438 // 4 seconds since feedback, expect increase. |
439 controller_->Process(); | 439 controller_->Process(); |
440 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; | 440 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
441 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); | 441 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
442 clock_.AdvanceTimeMilliseconds(800); | 442 clock_.AdvanceTimeMilliseconds(2000); |
443 | 443 |
444 // 1.8 seconds since feedback, expect no increase. | 444 // 6 seconds since feedback, expect no increase. |
445 controller_->Process(); | 445 controller_->Process(); |
446 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); | 446 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
447 clock_.AdvanceTimeMilliseconds(3701); | 447 clock_.AdvanceTimeMilliseconds(9001); |
448 | 448 |
449 // More than 4.5 seconds since feedback, expect decrease. | 449 // More than 15 seconds since feedback, expect decrease. |
450 controller_->Process(); | 450 controller_->Process(); |
451 expected_bitrate_bps *= 0.8; | 451 expected_bitrate_bps *= 0.8; |
452 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); | 452 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
453 clock_.AdvanceTimeMilliseconds(500); | 453 clock_.AdvanceTimeMilliseconds(500); |
454 | 454 |
455 // Only one timeout every second. | 455 // Only one timeout every second. |
456 controller_->Process(); | 456 controller_->Process(); |
457 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); | 457 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
458 clock_.AdvanceTimeMilliseconds(501); | 458 clock_.AdvanceTimeMilliseconds(501); |
459 | 459 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 clock_.AdvanceTimeMilliseconds(100); | 500 clock_.AdvanceTimeMilliseconds(100); |
501 | 501 |
502 // 15 packets reported as received since last, enough to increase. | 502 // 15 packets reported as received since last, enough to increase. |
503 report_blocks.push_back(CreateReportBlock(1, 2, 0, 41)); | 503 report_blocks.push_back(CreateReportBlock(1, 2, 0, 41)); |
504 bandwidth_observer_->OnReceivedRtcpReceiverReport( | 504 bandwidth_observer_->OnReceivedRtcpReceiverReport( |
505 report_blocks, 50, clock_.TimeInMilliseconds()); | 505 report_blocks, 50, clock_.TimeInMilliseconds()); |
506 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; | 506 expected_bitrate_bps = expected_bitrate_bps * 1.08 + 1000; |
507 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); | 507 EXPECT_EQ(expected_bitrate_bps, bitrate_observer_.last_bitrate_); |
508 clock_.AdvanceTimeMilliseconds(1000); | 508 clock_.AdvanceTimeMilliseconds(1000); |
509 } | 509 } |
OLD | NEW |