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 2609113003: BitrateProber::CreateProbeCluster now only accept one parameter (bitrate_bps). (Closed)
Patch Set: Comment fix 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
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 int packets_sent_; 98 int packets_sent_;
99 int padding_sent_; 99 int padding_sent_;
100 }; 100 };
101 101
102 class PacedSenderTest : public ::testing::Test { 102 class PacedSenderTest : public ::testing::Test {
103 protected: 103 protected:
104 PacedSenderTest() : clock_(123456) { 104 PacedSenderTest() : clock_(123456) {
105 srand(0); 105 srand(0);
106 // Need to initialize PacedSender after we initialize clock. 106 // Need to initialize PacedSender after we initialize clock.
107 send_bucket_.reset(new PacedSender(&clock_, &callback_)); 107 send_bucket_.reset(new PacedSender(&clock_, &callback_));
108 send_bucket_->CreateProbeCluster(kFirstClusterBps, kFirstClusterCount); 108 send_bucket_->CreateProbeCluster(kFirstClusterBps);
109 send_bucket_->CreateProbeCluster(kSecondClusterBps, kSecondClusterCount); 109 send_bucket_->CreateProbeCluster(kSecondClusterBps);
110 // Default to bitrate probing disabled for testing purposes. Probing tests 110 // Default to bitrate probing disabled for testing purposes. Probing tests
111 // have to enable probing, either by creating a new PacedSender instance or 111 // have to enable probing, either by creating a new PacedSender instance or
112 // by calling SetProbingEnabled(true). 112 // by calling SetProbingEnabled(true).
113 send_bucket_->SetProbingEnabled(false); 113 send_bucket_->SetProbingEnabled(false);
114 send_bucket_->SetEstimatedBitrate(kTargetBitrateBps); 114 send_bucket_->SetEstimatedBitrate(kTargetBitrateBps);
115 115
116 clock_.AdvanceTimeMilliseconds(send_bucket_->TimeUntilNextProcess()); 116 clock_.AdvanceTimeMilliseconds(send_bucket_->TimeUntilNextProcess());
117 } 117 }
118 118
119 void SendAndExpectPacket(PacedSender::Priority priority, 119 void SendAndExpectPacket(PacedSender::Priority priority,
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 799 }
800 800
801 TEST_F(PacedSenderTest, ProbingWithInsertedPackets) { 801 TEST_F(PacedSenderTest, ProbingWithInsertedPackets) {
802 const size_t kPacketSize = 1200; 802 const size_t kPacketSize = 1200;
803 const int kInitialBitrateBps = 300000; 803 const int kInitialBitrateBps = 300000;
804 uint32_t ssrc = 12346; 804 uint32_t ssrc = 12346;
805 uint16_t sequence_number = 1234; 805 uint16_t sequence_number = 1234;
806 806
807 PacedSenderProbing packet_sender; 807 PacedSenderProbing packet_sender;
808 send_bucket_.reset(new PacedSender(&clock_, &packet_sender)); 808 send_bucket_.reset(new PacedSender(&clock_, &packet_sender));
809 send_bucket_->CreateProbeCluster(kFirstClusterBps, kFirstClusterCount); 809 send_bucket_->CreateProbeCluster(kFirstClusterBps);
810 send_bucket_->CreateProbeCluster(kSecondClusterBps, kSecondClusterCount); 810 send_bucket_->CreateProbeCluster(kSecondClusterBps);
811 send_bucket_->SetEstimatedBitrate(kInitialBitrateBps); 811 send_bucket_->SetEstimatedBitrate(kInitialBitrateBps);
812 812
813 for (int i = 0; i < kFirstClusterCount + kSecondClusterCount; ++i) { 813 for (int i = 0; i < kFirstClusterCount + kSecondClusterCount; ++i) {
814 send_bucket_->InsertPacket(PacedSender::kNormalPriority, ssrc, 814 send_bucket_->InsertPacket(PacedSender::kNormalPriority, ssrc,
815 sequence_number++, clock_.TimeInMilliseconds(), 815 sequence_number++, clock_.TimeInMilliseconds(),
816 kPacketSize, false); 816 kPacketSize, false);
817 } 817 }
818 818
819 int64_t start = clock_.TimeInMilliseconds(); 819 int64_t start = clock_.TimeInMilliseconds();
820 while (packet_sender.packets_sent() < kFirstClusterCount) { 820 while (packet_sender.packets_sent() < kFirstClusterCount) {
(...skipping 24 matching lines...) Expand all
845 } 845 }
846 846
847 TEST_F(PacedSenderTest, ProbingWithPaddingSupport) { 847 TEST_F(PacedSenderTest, ProbingWithPaddingSupport) {
848 const size_t kPacketSize = 1200; 848 const size_t kPacketSize = 1200;
849 const int kInitialBitrateBps = 300000; 849 const int kInitialBitrateBps = 300000;
850 uint32_t ssrc = 12346; 850 uint32_t ssrc = 12346;
851 uint16_t sequence_number = 1234; 851 uint16_t sequence_number = 1234;
852 852
853 PacedSenderProbing packet_sender; 853 PacedSenderProbing packet_sender;
854 send_bucket_.reset(new PacedSender(&clock_, &packet_sender)); 854 send_bucket_.reset(new PacedSender(&clock_, &packet_sender));
855 send_bucket_->CreateProbeCluster(kFirstClusterBps, kFirstClusterCount); 855 send_bucket_->CreateProbeCluster(kFirstClusterBps);
856 send_bucket_->SetEstimatedBitrate(kInitialBitrateBps); 856 send_bucket_->SetEstimatedBitrate(kInitialBitrateBps);
857 857
858 for (int i = 0; i < kFirstClusterCount - 2; ++i) { 858 for (int i = 0; i < kFirstClusterCount - 2; ++i) {
859 send_bucket_->InsertPacket(PacedSender::kNormalPriority, ssrc, 859 send_bucket_->InsertPacket(PacedSender::kNormalPriority, ssrc,
860 sequence_number++, clock_.TimeInMilliseconds(), 860 sequence_number++, clock_.TimeInMilliseconds(),
861 kPacketSize, false); 861 kPacketSize, false);
862 } 862 }
863 863
864 int64_t start = clock_.TimeInMilliseconds(); 864 int64_t start = clock_.TimeInMilliseconds();
865 int process_count = 0; 865 int process_count = 0;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 1035
1036 // No more probing packets. 1036 // No more probing packets.
1037 EXPECT_CALL(callback_, TimeToSendPadding(_, PacketInfo::kNotAProbe)) 1037 EXPECT_CALL(callback_, TimeToSendPadding(_, PacketInfo::kNotAProbe))
1038 .Times(1) 1038 .Times(1)
1039 .WillRepeatedly(Return(500)); 1039 .WillRepeatedly(Return(500));
1040 send_bucket_->Process(); 1040 send_bucket_->Process();
1041 } 1041 }
1042 1042
1043 } // namespace test 1043 } // namespace test
1044 } // namespace webrtc 1044 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698