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

Side by Side Diff: webrtc/video/end_to_end_tests.cc

Issue 1502993003: Use existing parser in ReceivesAndRetransmitsNack. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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 | « no previous file | 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) 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 #include <algorithm> 10 #include <algorithm>
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 367
368 TEST_F(EndToEndTest, ReceivesAndRetransmitsNack) { 368 TEST_F(EndToEndTest, ReceivesAndRetransmitsNack) {
369 static const int kNumberOfNacksToObserve = 2; 369 static const int kNumberOfNacksToObserve = 2;
370 static const int kLossBurstSize = 2; 370 static const int kLossBurstSize = 2;
371 static const int kPacketsBetweenLossBursts = 9; 371 static const int kPacketsBetweenLossBursts = 9;
372 class NackObserver : public test::EndToEndTest { 372 class NackObserver : public test::EndToEndTest {
373 public: 373 public:
374 NackObserver() 374 NackObserver()
375 : EndToEndTest(kLongTimeoutMs), 375 : EndToEndTest(kLongTimeoutMs),
376 rtp_parser_(RtpHeaderParser::Create()),
377 sent_rtp_packets_(0), 376 sent_rtp_packets_(0),
378 packets_left_to_drop_(0), 377 packets_left_to_drop_(0),
379 nacks_left_(kNumberOfNacksToObserve) {} 378 nacks_left_(kNumberOfNacksToObserve) {}
380 379
381 private: 380 private:
382 Action OnSendRtp(const uint8_t* packet, size_t length) override { 381 Action OnSendRtp(const uint8_t* packet, size_t length) override {
383 rtc::CritScope lock(&crit_); 382 rtc::CritScope lock(&crit_);
384 RTPHeader header; 383 RTPHeader header;
385 EXPECT_TRUE(rtp_parser_->Parse(packet, length, &header)); 384 EXPECT_TRUE(parser_->Parse(packet, length, &header));
386 385
387 // Never drop retransmitted packets. 386 // Never drop retransmitted packets.
388 if (dropped_packets_.find(header.sequenceNumber) != 387 if (dropped_packets_.find(header.sequenceNumber) !=
389 dropped_packets_.end()) { 388 dropped_packets_.end()) {
390 retransmitted_packets_.insert(header.sequenceNumber); 389 retransmitted_packets_.insert(header.sequenceNumber);
391 if (nacks_left_ <= 0 && 390 if (nacks_left_ <= 0 &&
392 retransmitted_packets_.size() == dropped_packets_.size()) { 391 retransmitted_packets_.size() == dropped_packets_.size()) {
393 observation_complete_->Set(); 392 observation_complete_->Set();
394 } 393 }
395 return SEND_PACKET; 394 return SEND_PACKET;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 437 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
439 } 438 }
440 439
441 void PerformTest() override { 440 void PerformTest() override {
442 EXPECT_EQ(kEventSignaled, Wait()) 441 EXPECT_EQ(kEventSignaled, Wait())
443 << "Timed out waiting for packets to be NACKed, retransmitted and " 442 << "Timed out waiting for packets to be NACKed, retransmitted and "
444 "rendered."; 443 "rendered.";
445 } 444 }
446 445
447 rtc::CriticalSection crit_; 446 rtc::CriticalSection crit_;
448 rtc::scoped_ptr<RtpHeaderParser> rtp_parser_; 447 rtc::scoped_ptr<RtpHeaderParser> rtp_parser_;
sprang_webrtc 2015/12/07 14:37:15 Now this is unused and should be removed as well.
pbos-webrtc 2015/12/07 14:55:34 Sorry about that, https://codereview.webrtc.org/15
449 std::set<uint16_t> dropped_packets_; 448 std::set<uint16_t> dropped_packets_;
450 std::set<uint16_t> retransmitted_packets_; 449 std::set<uint16_t> retransmitted_packets_;
451 uint64_t sent_rtp_packets_; 450 uint64_t sent_rtp_packets_;
452 int packets_left_to_drop_; 451 int packets_left_to_drop_;
453 int nacks_left_ GUARDED_BY(&crit_); 452 int nacks_left_ GUARDED_BY(&crit_);
454 } test; 453 } test;
455 454
456 RunBaseTest(&test, FakeNetworkPipe::Config()); 455 RunBaseTest(&test, FakeNetworkPipe::Config());
457 } 456 }
458 457
(...skipping 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after
3225 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) 3224 EXPECT_TRUE(default_receive_config.rtp.rtx.empty())
3226 << "Enabling RTX requires rtpmap: rtx negotiation."; 3225 << "Enabling RTX requires rtpmap: rtx negotiation.";
3227 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) 3226 EXPECT_TRUE(default_receive_config.rtp.extensions.empty())
3228 << "Enabling RTP extensions require negotiation."; 3227 << "Enabling RTP extensions require negotiation.";
3229 3228
3230 VerifyEmptyNackConfig(default_receive_config.rtp.nack); 3229 VerifyEmptyNackConfig(default_receive_config.rtp.nack);
3231 VerifyEmptyFecConfig(default_receive_config.rtp.fec); 3230 VerifyEmptyFecConfig(default_receive_config.rtp.fec);
3232 } 3231 }
3233 3232
3234 } // namespace webrtc 3233 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698