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

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

Issue 2664213002: Don't send audio packets if the network is down. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « webrtc/modules/pacing/paced_sender.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 false); 622 false);
623 send_bucket_->InsertPacket(PacedSender::kHighPriority, ssrc_high_priority, 623 send_bucket_->InsertPacket(PacedSender::kHighPriority, ssrc_high_priority,
624 sequence_number++, second_capture_time_ms, 250, 624 sequence_number++, second_capture_time_ms, 250,
625 false); 625 false);
626 } 626 }
627 627
628 // Expect everything to be queued. 628 // Expect everything to be queued.
629 EXPECT_EQ(second_capture_time_ms - capture_time_ms, 629 EXPECT_EQ(second_capture_time_ms - capture_time_ms,
630 send_bucket_->QueueInMs()); 630 send_bucket_->QueueInMs());
631 631
632 // Expect only high priority packets to come out while paused.
633 EXPECT_CALL(callback_, TimeToSendPadding(_, _)).Times(0);
634 EXPECT_CALL(callback_, TimeToSendPacket(_, _, _, _, _)).Times(0);
635 EXPECT_CALL(callback_,
636 TimeToSendPacket(ssrc_high_priority, _, capture_time_ms, _, _))
637 .Times(packets_to_send_per_interval)
638 .WillRepeatedly(Return(true));
639 EXPECT_CALL(callback_, TimeToSendPacket(ssrc_high_priority, _,
640 second_capture_time_ms, _, _))
641 .Times(packets_to_send_per_interval)
642 .WillRepeatedly(Return(true));
643
644 for (int i = 0; i < 10; ++i) { 632 for (int i = 0; i < 10; ++i) {
645 clock_.AdvanceTimeMilliseconds(5); 633 clock_.AdvanceTimeMilliseconds(5);
646 EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess()); 634 EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess());
647 send_bucket_->Process(); 635 send_bucket_->Process();
648 } 636 }
649 637
650 // Expect normal prio packets to come out first (in capture order) 638 // Expect high prio packets to come out first followed by normal
651 // followed by all low prio packets (in capture order). 639 // prio packets and low prio packets (all in capture order).
652 { 640 {
653 ::testing::InSequence sequence; 641 ::testing::InSequence sequence;
642 EXPECT_CALL(callback_,
643 TimeToSendPacket(ssrc_high_priority, _, capture_time_ms, _, _))
644 .Times(packets_to_send_per_interval)
645 .WillRepeatedly(Return(true));
646 EXPECT_CALL(callback_, TimeToSendPacket(ssrc_high_priority, _,
647 second_capture_time_ms, _, _))
648 .Times(packets_to_send_per_interval)
649 .WillRepeatedly(Return(true));
650
654 for (size_t i = 0; i < packets_to_send_per_interval; ++i) { 651 for (size_t i = 0; i < packets_to_send_per_interval; ++i) {
655 EXPECT_CALL(callback_, TimeToSendPacket(ssrc, _, capture_time_ms, _, _)) 652 EXPECT_CALL(callback_, TimeToSendPacket(ssrc, _, capture_time_ms, _, _))
656 .Times(1) 653 .Times(1)
657 .WillRepeatedly(Return(true)); 654 .WillRepeatedly(Return(true));
658 } 655 }
659 for (size_t i = 0; i < packets_to_send_per_interval; ++i) { 656 for (size_t i = 0; i < packets_to_send_per_interval; ++i) {
660 EXPECT_CALL(callback_, 657 EXPECT_CALL(callback_,
661 TimeToSendPacket(ssrc, _, second_capture_time_ms, _, _)) 658 TimeToSendPacket(ssrc, _, second_capture_time_ms, _, _))
662 .Times(1) 659 .Times(1)
663 .WillRepeatedly(Return(true)); 660 .WillRepeatedly(Return(true));
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1030
1034 // No more probing packets. 1031 // No more probing packets.
1035 EXPECT_CALL(callback_, TimeToSendPadding(_, PacketInfo::kNotAProbe)) 1032 EXPECT_CALL(callback_, TimeToSendPadding(_, PacketInfo::kNotAProbe))
1036 .Times(1) 1033 .Times(1)
1037 .WillRepeatedly(Return(500)); 1034 .WillRepeatedly(Return(500));
1038 send_bucket_->Process(); 1035 send_bucket_->Process();
1039 } 1036 }
1040 1037
1041 } // namespace test 1038 } // namespace test
1042 } // namespace webrtc 1039 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/paced_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698