Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc

Issue 1151603008: Make the BWE threshold adaptive. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix string length issue. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unitt est_helper.h" 10 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unitt est_helper.h"
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 for (int j = i; j < number_of_streams; j++) { 506 for (int j = i; j < number_of_streams; j++) {
507 EXPECT_EQ(kDefaultSsrc + j, ssrcs[j - i]); 507 EXPECT_EQ(kDefaultSsrc + j, ssrcs[j - i]);
508 } 508 }
509 bitrate_estimator_->RemoveStream(kDefaultSsrc + i); 509 bitrate_estimator_->RemoveStream(kDefaultSsrc + i);
510 } 510 }
511 EXPECT_TRUE(bitrate_estimator_->LatestEstimate(&ssrcs, &latest_bps)); 511 EXPECT_TRUE(bitrate_estimator_->LatestEstimate(&ssrcs, &latest_bps));
512 EXPECT_EQ(0u, ssrcs.size()); 512 EXPECT_EQ(0u, ssrcs.size());
513 EXPECT_EQ(0u, latest_bps); 513 EXPECT_EQ(0u, latest_bps);
514 } 514 }
515 515
516 void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() { 516 void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper(
517 uint32_t bitrate_bps) {
517 const int kFramerate = 50; // 50 fps to avoid rounding errors. 518 const int kFramerate = 50; // 50 fps to avoid rounding errors.
518 const int kFrameIntervalMs = 1000 / kFramerate; 519 const int kFrameIntervalMs = 1000 / kFramerate;
519 const uint32_t kFrameIntervalAbsSendTime = AbsSendTime(1, kFramerate); 520 const uint32_t kFrameIntervalAbsSendTime = AbsSendTime(1, kFramerate);
520 uint32_t timestamp = 0; 521 uint32_t timestamp = 0;
521 // Initialize absolute_send_time (24 bits) so that it will definitely wrap 522 // Initialize absolute_send_time (24 bits) so that it will definitely wrap
522 // during the test. 523 // during the test.
523 uint32_t absolute_send_time = 524 uint32_t absolute_send_time =
524 AddAbsSendTime((1 << 24), -int(50 * kFrameIntervalAbsSendTime)); 525 AddAbsSendTime((1 << 24), -int(50 * kFrameIntervalAbsSendTime));
525 // Initial set of frames to increase the bitrate. 526 // Initial set of frames to increase the bitrate.
526 for (int i = 0; i <= 100; ++i) { 527 for (int i = 0; i <= 100; ++i) {
(...skipping 27 matching lines...) Expand all
554 } 555 }
555 // Increase time until next batch to simulate over-use. 556 // Increase time until next batch to simulate over-use.
556 clock_.AdvanceTimeMilliseconds(10); 557 clock_.AdvanceTimeMilliseconds(10);
557 timestamp += 90 * kFrameIntervalMs - kTimestampGroupLength; 558 timestamp += 90 * kFrameIntervalMs - kTimestampGroupLength;
558 absolute_send_time = AddAbsSendTime(absolute_send_time, AddAbsSendTime( 559 absolute_send_time = AddAbsSendTime(absolute_send_time, AddAbsSendTime(
559 kFrameIntervalAbsSendTime, -int(kTimestampGroupLengthAbsSendTime))); 560 kFrameIntervalAbsSendTime, -int(kTimestampGroupLengthAbsSendTime)));
560 bitrate_estimator_->Process(); 561 bitrate_estimator_->Process();
561 } 562 }
562 EXPECT_TRUE(bitrate_observer_->updated()); 563 EXPECT_TRUE(bitrate_observer_->updated());
563 // Should have reduced the estimate. 564 // Should have reduced the estimate.
564 EXPECT_EQ(378720u, bitrate_observer_->latest_bitrate()); 565 EXPECT_EQ(bitrate_bps, bitrate_observer_->latest_bitrate());
565 } 566 }
566 567
567 void RemoteBitrateEstimatorTest::TestGetStatsHelper() { 568 void RemoteBitrateEstimatorTest::TestGetStatsHelper() {
568 const int kFramerate = 100; 569 const int kFramerate = 100;
569 const int kFrameIntervalMs = 1000 / kFramerate; 570 const int kFrameIntervalMs = 1000 / kFramerate;
570 const int kBurstThresholdMs = 5; 571 const int kBurstThresholdMs = 5;
571 const uint32_t kFrameIntervalAbsSendTime = AbsSendTime(1, kFramerate); 572 const uint32_t kFrameIntervalAbsSendTime = AbsSendTime(1, kFramerate);
572 uint32_t timestamp = 0; 573 uint32_t timestamp = 0;
573 // Initialize absolute_send_time (24 bits) so that it will definitely wrap 574 // Initialize absolute_send_time (24 bits) so that it will definitely wrap
574 // during the test. 575 // during the test.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); 658 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs);
658 absolute_send_time = AddAbsSendTime(absolute_send_time, 659 absolute_send_time = AddAbsSendTime(absolute_send_time,
659 kFrameIntervalAbsSendTime); 660 kFrameIntervalAbsSendTime);
660 bitrate_estimator_->Process(); 661 bitrate_estimator_->Process();
661 } 662 }
662 unsigned int bitrate_after = 0; 663 unsigned int bitrate_after = 0;
663 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); 664 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after);
664 EXPECT_LT(bitrate_after, bitrate_before); 665 EXPECT_LT(bitrate_after, bitrate_before);
665 } 666 }
666 } // namespace webrtc 667 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698