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

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

Issue 1327933003: Enable probing with repeated payload packets by default. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing yet another flake in libjingle tests. Created 5 years, 3 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 #include <algorithm> 10 #include <algorithm>
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 private: 376 private:
377 Action OnSendRtp(const uint8_t* packet, size_t length) override { 377 Action OnSendRtp(const uint8_t* packet, size_t length) override {
378 RTPHeader header; 378 RTPHeader header;
379 EXPECT_TRUE(rtp_parser_->Parse(packet, length, &header)); 379 EXPECT_TRUE(rtp_parser_->Parse(packet, length, &header));
380 380
381 // Never drop retransmitted packets. 381 // Never drop retransmitted packets.
382 if (dropped_packets_.find(header.sequenceNumber) != 382 if (dropped_packets_.find(header.sequenceNumber) !=
383 dropped_packets_.end()) { 383 dropped_packets_.end()) {
384 retransmitted_packets_.insert(header.sequenceNumber); 384 retransmitted_packets_.insert(header.sequenceNumber);
385 if (nacks_left_ == 0 && 385 if (nacks_left_ <= 0 &&
386 retransmitted_packets_.size() == dropped_packets_.size()) { 386 retransmitted_packets_.size() == dropped_packets_.size()) {
387 observation_complete_->Set(); 387 observation_complete_->Set();
388 } 388 }
389 return SEND_PACKET; 389 return SEND_PACKET;
390 } 390 }
391 391
392 ++sent_rtp_packets_; 392 ++sent_rtp_packets_;
393 393
394 // Enough NACKs received, stop dropping packets. 394 // Enough NACKs received, stop dropping packets.
395 if (nacks_left_ == 0) 395 if (nacks_left_ <= 0)
396 return SEND_PACKET; 396 return SEND_PACKET;
397 397
398 // Check if it's time for a new loss burst. 398 // Check if it's time for a new loss burst.
399 if (sent_rtp_packets_ % kPacketsBetweenLossBursts == 0) 399 if (sent_rtp_packets_ % kPacketsBetweenLossBursts == 0)
400 packets_left_to_drop_ = kLossBurstSize; 400 packets_left_to_drop_ = kLossBurstSize;
401 401
402 // Never drop padding packets as those won't be retransmitted. 402 // Never drop padding packets as those won't be retransmitted.
403 if (packets_left_to_drop_ > 0 && header.paddingLength == 0) { 403 if (packets_left_to_drop_ > 0 && header.paddingLength == 0) {
404 --packets_left_to_drop_; 404 --packets_left_to_drop_;
405 dropped_packets_.insert(header.sequenceNumber); 405 dropped_packets_.insert(header.sequenceNumber);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 bool has_last_sequence_number_; 671 bool has_last_sequence_number_;
672 uint16_t last_sequence_number_; 672 uint16_t last_sequence_number_;
673 } test(config); 673 } test(config);
674 674
675 RunBaseTest(&test); 675 RunBaseTest(&test);
676 } 676 }
677 677
678 // This test drops second RTP packet with a marker bit set, makes sure it's 678 // This test drops second RTP packet with a marker bit set, makes sure it's
679 // retransmitted and renders. Retransmission SSRCs are also checked. 679 // retransmitted and renders. Retransmission SSRCs are also checked.
680 void EndToEndTest::DecodesRetransmittedFrame(bool use_rtx, bool use_red) { 680 void EndToEndTest::DecodesRetransmittedFrame(bool use_rtx, bool use_red) {
681 static const int kDroppedFrameNumber = 2; 681 // Must be set high enough to allow the bitrate probing to finish.
682 static const int kMinProbePackets = 30;
683 static const int kDroppedFrameNumber = kMinProbePackets + 1;
682 class RetransmissionObserver : public test::EndToEndTest, 684 class RetransmissionObserver : public test::EndToEndTest,
683 public I420FrameCallback { 685 public I420FrameCallback {
684 public: 686 public:
685 explicit RetransmissionObserver(bool use_rtx, bool use_red) 687 explicit RetransmissionObserver(bool use_rtx, bool use_red)
686 : EndToEndTest(kDefaultTimeoutMs), 688 : EndToEndTest(kDefaultTimeoutMs),
687 payload_type_(GetPayloadType(false, use_red)), 689 payload_type_(GetPayloadType(false, use_red)),
688 retransmission_ssrc_(use_rtx ? kSendRtxSsrcs[0] : kSendSsrcs[0]), 690 retransmission_ssrc_(use_rtx ? kSendRtxSsrcs[0] : kSendSsrcs[0]),
689 retransmission_payload_type_(GetPayloadType(use_rtx, use_red)), 691 retransmission_payload_type_(GetPayloadType(use_rtx, use_red)),
690 marker_bits_observed_(0), 692 marker_bits_observed_(0),
693 num_packets_observed_(0),
691 retransmitted_timestamp_(0), 694 retransmitted_timestamp_(0),
692 frame_retransmitted_(false) {} 695 frame_retransmitted_(false) {}
693 696
694 private: 697 private:
695 Action OnSendRtp(const uint8_t* packet, size_t length) override { 698 Action OnSendRtp(const uint8_t* packet, size_t length) override {
696 RTPHeader header; 699 RTPHeader header;
697 EXPECT_TRUE(parser_->Parse(packet, length, &header)); 700 EXPECT_TRUE(parser_->Parse(packet, length, &header));
698 701
702 // We accept some padding or RTX packets in the beginning to enable
703 // bitrate probing.
704 if (num_packets_observed_++ < kMinProbePackets &&
705 header.payloadType != payload_type_) {
706 EXPECT_TRUE(retransmission_payload_type_ == header.payloadType ||
707 length == header.headerLength + header.paddingLength);
708 return SEND_PACKET;
709 }
699 if (header.timestamp == retransmitted_timestamp_) { 710 if (header.timestamp == retransmitted_timestamp_) {
700 EXPECT_EQ(retransmission_ssrc_, header.ssrc); 711 EXPECT_EQ(retransmission_ssrc_, header.ssrc);
701 EXPECT_EQ(retransmission_payload_type_, header.payloadType); 712 EXPECT_EQ(retransmission_payload_type_, header.payloadType);
702 frame_retransmitted_ = true; 713 frame_retransmitted_ = true;
703 return SEND_PACKET; 714 return SEND_PACKET;
704 } 715 }
705 716
706 EXPECT_EQ(kSendSsrcs[0], header.ssrc); 717 EXPECT_EQ(kSendSsrcs[0], header.ssrc);
707 EXPECT_EQ(payload_type_, header.payloadType); 718 EXPECT_EQ(payload_type_, header.payloadType);
708 719
709 // Found the second frame's final packet, drop this and expect a 720 // Found the final packet of the frame to inflict loss to, drop this and
710 // retransmission. 721 // expect a retransmission.
711 if (header.markerBit && ++marker_bits_observed_ == kDroppedFrameNumber) { 722 if (header.markerBit && ++marker_bits_observed_ == kDroppedFrameNumber) {
712 retransmitted_timestamp_ = header.timestamp; 723 retransmitted_timestamp_ = header.timestamp;
713 return DROP_PACKET; 724 return DROP_PACKET;
714 } 725 }
715 726
716 return SEND_PACKET; 727 return SEND_PACKET;
717 } 728 }
718 729
719 void FrameCallback(VideoFrame* frame) override { 730 void FrameCallback(VideoFrame* frame) override {
720 rtc::CritScope lock(&crit_); 731 rtc::CritScope lock(&crit_);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 766
756 int GetPayloadType(bool use_rtx, bool use_red) { 767 int GetPayloadType(bool use_rtx, bool use_red) {
757 return use_rtx ? kSendRtxPayloadType 768 return use_rtx ? kSendRtxPayloadType
758 : (use_red ? kRedPayloadType : kFakeSendPayloadType); 769 : (use_red ? kRedPayloadType : kFakeSendPayloadType);
759 } 770 }
760 771
761 const int payload_type_; 772 const int payload_type_;
762 const uint32_t retransmission_ssrc_; 773 const uint32_t retransmission_ssrc_;
763 const int retransmission_payload_type_; 774 const int retransmission_payload_type_;
764 int marker_bits_observed_; 775 int marker_bits_observed_;
776 int num_packets_observed_;
765 uint32_t retransmitted_timestamp_; 777 uint32_t retransmitted_timestamp_;
766 bool frame_retransmitted_; 778 bool frame_retransmitted_;
767 } test(use_rtx, use_red); 779 } test(use_rtx, use_red);
768 780
769 RunBaseTest(&test); 781 RunBaseTest(&test);
770 } 782 }
771 783
772 TEST_F(EndToEndTest, DecodesRetransmittedFrame) { 784 TEST_F(EndToEndTest, DecodesRetransmittedFrame) {
773 DecodesRetransmittedFrame(false, false); 785 DecodesRetransmittedFrame(false, false);
774 } 786 }
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) 3059 EXPECT_TRUE(default_receive_config.rtp.rtx.empty())
3048 << "Enabling RTX requires rtpmap: rtx negotiation."; 3060 << "Enabling RTX requires rtpmap: rtx negotiation.";
3049 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) 3061 EXPECT_TRUE(default_receive_config.rtp.extensions.empty())
3050 << "Enabling RTP extensions require negotiation."; 3062 << "Enabling RTP extensions require negotiation.";
3051 3063
3052 VerifyEmptyNackConfig(default_receive_config.rtp.nack); 3064 VerifyEmptyNackConfig(default_receive_config.rtp.nack);
3053 VerifyEmptyFecConfig(default_receive_config.rtp.fec); 3065 VerifyEmptyFecConfig(default_receive_config.rtp.fec);
3054 } 3066 }
3055 3067
3056 } // namespace webrtc 3068 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698