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

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

Issue 1327933003: Enable probing with repeated payload packets by default. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing yet another flake in libjingle tests. Created 5 years, 3 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') | webrtc/modules/rtp_rtcp/source/rtp_sender.h » ('j') | 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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 while (callback.packets_sent() < kNumPackets) { 736 while (callback.packets_sent() < kNumPackets) {
737 int time_until_process = send_bucket_->TimeUntilNextProcess(); 737 int time_until_process = send_bucket_->TimeUntilNextProcess();
738 if (time_until_process <= 0) { 738 if (time_until_process <= 0) {
739 send_bucket_->Process(); 739 send_bucket_->Process();
740 } else { 740 } else {
741 clock_.AdvanceTimeMilliseconds(time_until_process); 741 clock_.AdvanceTimeMilliseconds(time_until_process);
742 } 742 }
743 } 743 }
744 } 744 }
745 745
746 class ProbingPacedSender : public PacedSender {
747 public:
748 ProbingPacedSender(Clock* clock,
749 Callback* callback,
750 int bitrate_kbps,
751 int max_bitrate_kbps,
752 int min_bitrate_kbps)
753 : PacedSender(clock,
754 callback,
755 bitrate_kbps,
756 max_bitrate_kbps,
757 min_bitrate_kbps) {}
758
759 bool ProbingExperimentIsEnabled() const override { return true; }
760 };
761
762 TEST_F(PacedSenderTest, ProbingWithTooSmallInitialFrame) { 746 TEST_F(PacedSenderTest, ProbingWithTooSmallInitialFrame) {
763 const int kNumPackets = 11; 747 const int kNumPackets = 11;
764 const int kNumDeltas = kNumPackets - 1; 748 const int kNumDeltas = kNumPackets - 1;
765 const size_t kPacketSize = 1200; 749 const size_t kPacketSize = 1200;
766 const int kInitialBitrateKbps = 300; 750 const int kInitialBitrateKbps = 300;
767 uint32_t ssrc = 12346; 751 uint32_t ssrc = 12346;
768 uint16_t sequence_number = 1234; 752 uint16_t sequence_number = 1234;
769 const int expected_deltas[kNumDeltas] = {10, 10, 10, 10, 10, 5, 5, 5, 5, 5}; 753 const int expected_deltas[kNumDeltas] = {10, 10, 10, 10, 10, 5, 5, 5, 5, 5};
770 std::list<int> expected_deltas_list(expected_deltas, 754 std::list<int> expected_deltas_list(expected_deltas,
771 expected_deltas + kNumPackets - 1); 755 expected_deltas + kNumPackets - 1);
772 PacedSenderProbing callback(expected_deltas_list, &clock_); 756 PacedSenderProbing callback(expected_deltas_list, &clock_);
773 send_bucket_.reset( 757 send_bucket_.reset(new PacedSender(&clock_, &callback, kInitialBitrateKbps,
774 new ProbingPacedSender(&clock_, &callback, kInitialBitrateKbps, 758 kPaceMultiplier * kInitialBitrateKbps, 0));
775 kPaceMultiplier * kInitialBitrateKbps, 0));
776 759
777 for (int i = 0; i < kNumPackets - 5; ++i) { 760 for (int i = 0; i < kNumPackets - 5; ++i) {
778 EXPECT_FALSE(send_bucket_->SendPacket( 761 EXPECT_FALSE(send_bucket_->SendPacket(
779 PacedSender::kNormalPriority, ssrc, sequence_number++, 762 PacedSender::kNormalPriority, ssrc, sequence_number++,
780 clock_.TimeInMilliseconds(), kPacketSize, false)); 763 clock_.TimeInMilliseconds(), kPacketSize, false));
781 } 764 }
782 while (callback.packets_sent() < kNumPackets) { 765 while (callback.packets_sent() < kNumPackets) {
783 int time_until_process = send_bucket_->TimeUntilNextProcess(); 766 int time_until_process = send_bucket_->TimeUntilNextProcess();
784 if (time_until_process <= 0) { 767 if (time_until_process <= 0) {
785 send_bucket_->Process(); 768 send_bucket_->Process();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 PacedSender::kHighPriority, ssrc, sequence_number++, 846 PacedSender::kHighPriority, ssrc, sequence_number++,
864 clock_.TimeInMilliseconds(), kPacketSize, false)); 847 clock_.TimeInMilliseconds(), kPacketSize, false));
865 848
866 // Don't send padding if queue is non-empty, even if padding budget > 0. 849 // Don't send padding if queue is non-empty, even if padding budget > 0.
867 EXPECT_CALL(callback_, TimeToSendPadding(_)).Times(0); 850 EXPECT_CALL(callback_, TimeToSendPadding(_)).Times(0);
868 send_bucket_->Process(); 851 send_bucket_->Process();
869 } 852 }
870 853
871 } // namespace test 854 } // namespace test
872 } // namespace webrtc 855 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/paced_sender.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698