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

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

Issue 2626473004: Revert of Fix BitrateProber to match the requested bitrate more precisely (Closed)
Patch Set: 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());
832 start = clock_.TimeInMilliseconds(); 831 start = clock_.TimeInMilliseconds();
833 while (packet_sender.packets_sent() < 10) { 832 while (packet_sender.packets_sent() < 10) {
834 int time_until_process = send_bucket_->TimeUntilNextProcess(); 833 int time_until_process = send_bucket_->TimeUntilNextProcess();
835 clock_.AdvanceTimeMilliseconds(time_until_process); 834 clock_.AdvanceTimeMilliseconds(time_until_process);
836 send_bucket_->Process(); 835 send_bucket_->Process();
837 } 836 }
838 packets_sent = packet_sender.packets_sent() - packets_sent; 837 packets_sent = packet_sender.packets_sent() - packets_sent;
839 // Validate second cluster bitrate. 838 // Validate second cluster bitrate.
840 EXPECT_NEAR((packets_sent - 1) * kPacketSize * 8000 / 839 EXPECT_NEAR(
841 (clock_.TimeInMilliseconds() - start), 840 packets_sent * kPacketSize * 8000 / (clock_.TimeInMilliseconds() - start),
842 kSecondClusterBps, kBitrateProbingError); 841 kSecondClusterBps, kBitrateProbingError);
843 } 842 }
844 843
845 TEST_F(PacedSenderTest, ProbingWithPaddingSupport) { 844 TEST_F(PacedSenderTest, ProbingWithPaddingSupport) {
846 const size_t kPacketSize = 1200; 845 const size_t kPacketSize = 1200;
847 const int kInitialBitrateBps = 300000; 846 const int kInitialBitrateBps = 300000;
848 uint32_t ssrc = 12346; 847 uint32_t ssrc = 12346;
849 uint16_t sequence_number = 1234; 848 uint16_t sequence_number = 1234;
850 849
851 PacedSenderProbing packet_sender; 850 PacedSenderProbing packet_sender;
852 send_bucket_.reset(new PacedSender(&clock_, &packet_sender)); 851 send_bucket_.reset(new PacedSender(&clock_, &packet_sender));
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1032
1034 // No more probing packets. 1033 // No more probing packets.
1035 EXPECT_CALL(callback_, TimeToSendPadding(_, PacketInfo::kNotAProbe)) 1034 EXPECT_CALL(callback_, TimeToSendPadding(_, PacketInfo::kNotAProbe))
1036 .Times(1) 1035 .Times(1)
1037 .WillRepeatedly(Return(500)); 1036 .WillRepeatedly(Return(500));
1038 send_bucket_->Process(); 1037 send_bucket_->Process();
1039 } 1038 }
1040 1039
1041 } // namespace test 1040 } // namespace test
1042 } // namespace webrtc 1041 } // 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