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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc

Issue 2131913003: Revert of Refactor NACK bitrate allocation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
11 #include <algorithm> 11 #include <algorithm>
12 #include <iterator> 12 #include <iterator>
13 #include <list> 13 #include <list>
14 #include <memory> 14 #include <memory>
15 #include <set> 15 #include <set>
16 16
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include "webrtc/base/rate_limiter.h"
19 #include "webrtc/common_types.h" 18 #include "webrtc/common_types.h"
20 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" 19 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
21 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
22 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" 21 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
23 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 22 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
26 #include "webrtc/transport.h" 25 #include "webrtc/transport.h"
27 26
28 namespace webrtc { 27 namespace webrtc {
29 28
30 const int kVideoNackListSize = 30; 29 const int kVideoNackListSize = 30;
31 const uint32_t kTestSsrc = 3456; 30 const uint32_t kTestSsrc = 3456;
32 const uint16_t kTestSequenceNumber = 2345; 31 const uint16_t kTestSequenceNumber = 2345;
33 const uint32_t kTestNumberOfPackets = 1350; 32 const uint32_t kTestNumberOfPackets = 1350;
34 const int kTestNumberOfRtxPackets = 149; 33 const int kTestNumberOfRtxPackets = 149;
35 const int kNumFrames = 30; 34 const int kNumFrames = 30;
36 const int kPayloadType = 123; 35 const int kPayloadType = 123;
37 const int kRtxPayloadType = 98; 36 const int kRtxPayloadType = 98;
38 const int64_t kMaxRttMs = 1000;
39 37
40 class VerifyingRtxReceiver : public NullRtpData { 38 class VerifyingRtxReceiver : public NullRtpData {
41 public: 39 public:
42 VerifyingRtxReceiver() {} 40 VerifyingRtxReceiver() {}
43 41
44 int32_t OnReceivedPayloadData( 42 int32_t OnReceivedPayloadData(
45 const uint8_t* data, 43 const uint8_t* data,
46 size_t size, 44 size_t size,
47 const webrtc::WebRtcRTPHeader* rtp_header) override { 45 const webrtc::WebRtcRTPHeader* rtp_header) override {
48 if (!sequence_numbers_.empty()) 46 if (!sequence_numbers_.empty())
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 RTPPayloadRegistry* rtp_payload_registry_; 161 RTPPayloadRegistry* rtp_payload_registry_;
164 RtpReceiver* rtp_receiver_; 162 RtpReceiver* rtp_receiver_;
165 RtpRtcp* module_; 163 RtpRtcp* module_;
166 std::set<uint16_t> expected_sequence_numbers_; 164 std::set<uint16_t> expected_sequence_numbers_;
167 }; 165 };
168 166
169 class RtpRtcpRtxNackTest : public ::testing::Test { 167 class RtpRtcpRtxNackTest : public ::testing::Test {
170 protected: 168 protected:
171 RtpRtcpRtxNackTest() 169 RtpRtcpRtxNackTest()
172 : rtp_payload_registry_(RTPPayloadStrategy::CreateStrategy(false)), 170 : rtp_payload_registry_(RTPPayloadStrategy::CreateStrategy(false)),
173 rtp_rtcp_module_(nullptr), 171 rtp_rtcp_module_(NULL),
174 transport_(kTestSsrc + 1), 172 transport_(kTestSsrc + 1),
175 receiver_(), 173 receiver_(),
176 payload_data_length(sizeof(payload_data)), 174 payload_data_length(sizeof(payload_data)),
177 fake_clock(123456), 175 fake_clock(123456) {}
178 retranmission_rate_limiter_(&fake_clock, kMaxRttMs) {}
179 ~RtpRtcpRtxNackTest() {} 176 ~RtpRtcpRtxNackTest() {}
180 177
181 void SetUp() override { 178 void SetUp() override {
182 RtpRtcp::Configuration configuration; 179 RtpRtcp::Configuration configuration;
183 configuration.audio = false; 180 configuration.audio = false;
184 configuration.clock = &fake_clock; 181 configuration.clock = &fake_clock;
185 receive_statistics_.reset(ReceiveStatistics::Create(&fake_clock)); 182 receive_statistics_.reset(ReceiveStatistics::Create(&fake_clock));
186 configuration.receive_statistics = receive_statistics_.get(); 183 configuration.receive_statistics = receive_statistics_.get();
187 configuration.outgoing_transport = &transport_; 184 configuration.outgoing_transport = &transport_;
188 configuration.retransmission_rate_limiter = &retranmission_rate_limiter_;
189 rtp_rtcp_module_ = RtpRtcp::CreateRtpRtcp(configuration); 185 rtp_rtcp_module_ = RtpRtcp::CreateRtpRtcp(configuration);
190 186
191 rtp_feedback_.reset(new TestRtpFeedback(rtp_rtcp_module_)); 187 rtp_feedback_.reset(new TestRtpFeedback(rtp_rtcp_module_));
192 188
193 rtp_receiver_.reset(RtpReceiver::CreateVideoReceiver( 189 rtp_receiver_.reset(RtpReceiver::CreateVideoReceiver(
194 &fake_clock, &receiver_, rtp_feedback_.get(), &rtp_payload_registry_)); 190 &fake_clock, &receiver_, rtp_feedback_.get(), &rtp_payload_registry_));
195 191
196 rtp_rtcp_module_->SetSSRC(kTestSsrc); 192 rtp_rtcp_module_->SetSSRC(kTestSsrc);
197 rtp_rtcp_module_->SetRTCPStatus(RtcpMode::kCompound); 193 rtp_rtcp_module_->SetRTCPStatus(RtcpMode::kCompound);
198 rtp_rtcp_module_->SetStorePacketsStatus(true, 600); 194 rtp_rtcp_module_->SetStorePacketsStatus(true, 600);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 std::unique_ptr<ReceiveStatistics> receive_statistics_; 281 std::unique_ptr<ReceiveStatistics> receive_statistics_;
286 RTPPayloadRegistry rtp_payload_registry_; 282 RTPPayloadRegistry rtp_payload_registry_;
287 std::unique_ptr<RtpReceiver> rtp_receiver_; 283 std::unique_ptr<RtpReceiver> rtp_receiver_;
288 RtpRtcp* rtp_rtcp_module_; 284 RtpRtcp* rtp_rtcp_module_;
289 std::unique_ptr<TestRtpFeedback> rtp_feedback_; 285 std::unique_ptr<TestRtpFeedback> rtp_feedback_;
290 RtxLoopBackTransport transport_; 286 RtxLoopBackTransport transport_;
291 VerifyingRtxReceiver receiver_; 287 VerifyingRtxReceiver receiver_;
292 uint8_t payload_data[65000]; 288 uint8_t payload_data[65000];
293 size_t payload_data_length; 289 size_t payload_data_length;
294 SimulatedClock fake_clock; 290 SimulatedClock fake_clock;
295 RateLimiter retranmission_rate_limiter_;
296 }; 291 };
297 292
298 TEST_F(RtpRtcpRtxNackTest, LongNackList) { 293 TEST_F(RtpRtcpRtxNackTest, LongNackList) {
299 const int kNumPacketsToDrop = 900; 294 const int kNumPacketsToDrop = 900;
300 const int kNumRequiredRtcp = 4; 295 const int kNumRequiredRtcp = 4;
301 uint32_t timestamp = 3000; 296 uint32_t timestamp = 3000;
302 uint16_t nack_list[kNumPacketsToDrop]; 297 uint16_t nack_list[kNumPacketsToDrop];
303 // Disable StorePackets to be able to set a larger packet history. 298 // Disable StorePackets to be able to set a larger packet history.
304 rtp_rtcp_module_->SetStorePacketsStatus(false, 0); 299 rtp_rtcp_module_->SetStorePacketsStatus(false, 0);
305 // Enable StorePackets with a packet history of 2000 packets. 300 // Enable StorePackets with a packet history of 2000 packets.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 RunRtxTest(kRtxRetransmitted, 10); 332 RunRtxTest(kRtxRetransmitted, 10);
338 EXPECT_EQ(kTestSequenceNumber, *(receiver_.sequence_numbers_.begin())); 333 EXPECT_EQ(kTestSequenceNumber, *(receiver_.sequence_numbers_.begin()));
339 EXPECT_EQ(kTestSequenceNumber + kTestNumberOfPackets - 1, 334 EXPECT_EQ(kTestSequenceNumber + kTestNumberOfPackets - 1,
340 *(receiver_.sequence_numbers_.rbegin())); 335 *(receiver_.sequence_numbers_.rbegin()));
341 EXPECT_EQ(kTestNumberOfPackets, receiver_.sequence_numbers_.size()); 336 EXPECT_EQ(kTestNumberOfPackets, receiver_.sequence_numbers_.size());
342 EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_); 337 EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_);
343 EXPECT_TRUE(ExpectedPacketsReceived()); 338 EXPECT_TRUE(ExpectedPacketsReceived());
344 } 339 }
345 340
346 } // namespace webrtc 341 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/bitrate.cc ('k') | webrtc/modules/rtp_rtcp/source/receive_statistics_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698