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

Side by Side Diff: webrtc/modules/pacing/paced_sender_unittest.cc

Issue 3001653002: Revert of Add functionality which limits the number of bytes on the network. (Closed)
Patch Set: Created 3 years, 4 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 10
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 false); 644 false);
645 send_bucket_->InsertPacket(PacedSender::kHighPriority, ssrc_high_priority, 645 send_bucket_->InsertPacket(PacedSender::kHighPriority, ssrc_high_priority,
646 sequence_number++, second_capture_time_ms, 250, 646 sequence_number++, second_capture_time_ms, 250,
647 false); 647 false);
648 } 648 }
649 649
650 // Expect everything to be queued. 650 // Expect everything to be queued.
651 EXPECT_EQ(second_capture_time_ms - capture_time_ms, 651 EXPECT_EQ(second_capture_time_ms - capture_time_ms,
652 send_bucket_->QueueInMs()); 652 send_bucket_->QueueInMs());
653 653
654 EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); 654 for (int i = 0; i < 10; ++i) {
655 EXPECT_CALL(callback_, TimeToSendPadding(1, _)).Times(1); 655 clock_.AdvanceTimeMilliseconds(5);
656 send_bucket_->Process();
657
658 int64_t expected_time_until_send = 500;
659 EXPECT_CALL(callback_, TimeToSendPadding(1, _)).Times(1);
660 while (expected_time_until_send >= 0) {
661 // TimeUntilNextProcess must not return 0 when paused. If it does, 656 // TimeUntilNextProcess must not return 0 when paused. If it does,
662 // we risk running a busy loop, so ideally it should return a large value. 657 // we risk running a busy loop, so ideally it should return a large value.
663 EXPECT_EQ(expected_time_until_send, send_bucket_->TimeUntilNextProcess()); 658 EXPECT_GE(send_bucket_->TimeUntilNextProcess(), 1000);
664 if (expected_time_until_send == 0) 659 send_bucket_->Process();
665 send_bucket_->Process();
666 clock_.AdvanceTimeMilliseconds(5);
667 expected_time_until_send -= 5;
668 } 660 }
669 661
670 // Expect high prio packets to come out first followed by normal 662 // Expect high prio packets to come out first followed by normal
671 // prio packets and low prio packets (all in capture order). 663 // prio packets and low prio packets (all in capture order).
672 { 664 {
673 ::testing::InSequence sequence; 665 ::testing::InSequence sequence;
674 EXPECT_CALL(callback_, 666 EXPECT_CALL(callback_,
675 TimeToSendPacket(ssrc_high_priority, _, capture_time_ms, _, _)) 667 TimeToSendPacket(ssrc_high_priority, _, capture_time_ms, _, _))
676 .Times(packets_to_send_per_interval) 668 .Times(packets_to_send_per_interval)
677 .WillRepeatedly(Return(true)); 669 .WillRepeatedly(Return(true));
(...skipping 22 matching lines...) Expand all
700 for (size_t i = 0; i < packets_to_send_per_interval; ++i) { 692 for (size_t i = 0; i < packets_to_send_per_interval; ++i) {
701 EXPECT_CALL(callback_, TimeToSendPacket(ssrc_low_priority, _, 693 EXPECT_CALL(callback_, TimeToSendPacket(ssrc_low_priority, _,
702 second_capture_time_ms, _, _)) 694 second_capture_time_ms, _, _))
703 .Times(1) 695 .Times(1)
704 .WillRepeatedly(Return(true)); 696 .WillRepeatedly(Return(true));
705 } 697 }
706 } 698 }
707 send_bucket_->Resume(); 699 send_bucket_->Resume();
708 700
709 for (size_t i = 0; i < 4; i++) { 701 for (size_t i = 0; i < 4; i++) {
702 EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());
703 clock_.AdvanceTimeMilliseconds(5);
710 EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); 704 EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess());
711 send_bucket_->Process(); 705 send_bucket_->Process();
712 EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());
713 clock_.AdvanceTimeMilliseconds(5);
714 } 706 }
715 707
716 EXPECT_EQ(0, send_bucket_->QueueInMs()); 708 EXPECT_EQ(0, send_bucket_->QueueInMs());
717 } 709 }
718 710
719 TEST_F(PacedSenderTest, ResendPacket) { 711 TEST_F(PacedSenderTest, ResendPacket) {
720 uint32_t ssrc = 12346; 712 uint32_t ssrc = 12346;
721 uint16_t sequence_number = 1234; 713 uint16_t sequence_number = 1234;
722 int64_t capture_time_ms = clock_.TimeInMilliseconds(); 714 int64_t capture_time_ms = clock_.TimeInMilliseconds();
723 EXPECT_EQ(0, send_bucket_->QueueInMs()); 715 EXPECT_EQ(0, send_bucket_->QueueInMs());
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 .WillRepeatedly(Return(0)); 1089 .WillRepeatedly(Return(0));
1098 send_bucket_->Process(); 1090 send_bucket_->Process();
1099 EXPECT_EQ(1, send_bucket_->TimeUntilNextProcess()); 1091 EXPECT_EQ(1, send_bucket_->TimeUntilNextProcess());
1100 clock_.AdvanceTimeMilliseconds(1); 1092 clock_.AdvanceTimeMilliseconds(1);
1101 send_bucket_->Process(); 1093 send_bucket_->Process();
1102 EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess()); 1094 EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());
1103 } 1095 }
1104 1096
1105 } // namespace test 1097 } // namespace test
1106 } // namespace webrtc 1098 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/paced_sender.cc ('k') | webrtc/modules/remote_bitrate_estimator/include/send_time_history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698