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

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

Issue 2613543003: Fix BitrateProber to match the requested bitrate more precisely (Closed)
Patch Set: Limit number of retries Created 3 years, 11 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/bitrate_prober_unittest.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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 send_bucket_->Process(); 821 send_bucket_->Process();
822 } 822 }
823 int packets_sent = packet_sender.packets_sent(); 823 int packets_sent = packet_sender.packets_sent();
824 // Validate first cluster bitrate. Note that we have to account for number 824 // Validate first cluster bitrate. Note that we have to account for number
825 // of intervals and hence (packets_sent - 1) on the first cluster. 825 // of intervals and hence (packets_sent - 1) on the first cluster.
826 EXPECT_NEAR((packets_sent - 1) * kPacketSize * 8000 / 826 EXPECT_NEAR((packets_sent - 1) * kPacketSize * 8000 /
827 (clock_.TimeInMilliseconds() - start), 827 (clock_.TimeInMilliseconds() - start),
828 kFirstClusterBps, kBitrateProbingError); 828 kFirstClusterBps, kBitrateProbingError);
829 EXPECT_EQ(0, packet_sender.padding_sent()); 829 EXPECT_EQ(0, packet_sender.padding_sent());
830 830
831 clock_.AdvanceTimeMilliseconds(send_bucket_->TimeUntilNextProcess());
831 start = clock_.TimeInMilliseconds(); 832 start = clock_.TimeInMilliseconds();
832 while (packet_sender.packets_sent() < 10) { 833 while (packet_sender.packets_sent() < 10) {
833 int time_until_process = send_bucket_->TimeUntilNextProcess(); 834 int time_until_process = send_bucket_->TimeUntilNextProcess();
834 clock_.AdvanceTimeMilliseconds(time_until_process); 835 clock_.AdvanceTimeMilliseconds(time_until_process);
835 send_bucket_->Process(); 836 send_bucket_->Process();
836 } 837 }
837 packets_sent = packet_sender.packets_sent() - packets_sent; 838 packets_sent = packet_sender.packets_sent() - packets_sent;
838 // Validate second cluster bitrate. 839 // Validate second cluster bitrate.
839 EXPECT_NEAR( 840 EXPECT_NEAR((packets_sent - 1) * kPacketSize * 8000 /
840 packets_sent * kPacketSize * 8000 / (clock_.TimeInMilliseconds() - start), 841 (clock_.TimeInMilliseconds() - start),
841 kSecondClusterBps, kBitrateProbingError); 842 kSecondClusterBps, kBitrateProbingError);
842 } 843 }
843 844
844 TEST_F(PacedSenderTest, ProbingWithPaddingSupport) { 845 TEST_F(PacedSenderTest, ProbingWithPaddingSupport) {
845 const size_t kPacketSize = 1200; 846 const size_t kPacketSize = 1200;
846 const int kInitialBitrateBps = 300000; 847 const int kInitialBitrateBps = 300000;
847 uint32_t ssrc = 12346; 848 uint32_t ssrc = 12346;
848 uint16_t sequence_number = 1234; 849 uint16_t sequence_number = 1234;
849 850
850 PacedSenderProbing packet_sender; 851 PacedSenderProbing packet_sender;
851 send_bucket_.reset(new PacedSender(&clock_, &packet_sender)); 852 send_bucket_.reset(new PacedSender(&clock_, &packet_sender));
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 1033
1033 // No more probing packets. 1034 // No more probing packets.
1034 EXPECT_CALL(callback_, TimeToSendPadding(_, PacketInfo::kNotAProbe)) 1035 EXPECT_CALL(callback_, TimeToSendPadding(_, PacketInfo::kNotAProbe))
1035 .Times(1) 1036 .Times(1)
1036 .WillRepeatedly(Return(500)); 1037 .WillRepeatedly(Return(500));
1037 send_bucket_->Process(); 1038 send_bucket_->Process();
1038 } 1039 }
1039 1040
1040 } // namespace test 1041 } // namespace test
1041 } // namespace webrtc 1042 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/pacing/bitrate_prober_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698