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

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

Issue 2180903002: flaky EndToEndTest.DecodesRetransmittedFrame adjusted (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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 | « 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 public I420FrameCallback { 761 public I420FrameCallback {
762 public: 762 public:
763 RetransmissionObserver(bool enable_rtx, bool enable_red) 763 RetransmissionObserver(bool enable_rtx, bool enable_red)
764 : EndToEndTest(kDefaultTimeoutMs), 764 : EndToEndTest(kDefaultTimeoutMs),
765 payload_type_(GetPayloadType(false, enable_red)), 765 payload_type_(GetPayloadType(false, enable_red)),
766 retransmission_ssrc_(enable_rtx ? kSendRtxSsrcs[0] 766 retransmission_ssrc_(enable_rtx ? kSendRtxSsrcs[0]
767 : kVideoSendSsrcs[0]), 767 : kVideoSendSsrcs[0]),
768 retransmission_payload_type_(GetPayloadType(enable_rtx, enable_red)), 768 retransmission_payload_type_(GetPayloadType(enable_rtx, enable_red)),
769 encoder_(VideoEncoder::Create(VideoEncoder::EncoderType::kVp8)), 769 encoder_(VideoEncoder::Create(VideoEncoder::EncoderType::kVp8)),
770 marker_bits_observed_(0), 770 marker_bits_observed_(0),
771 retransmitted_timestamp_(0), 771 retransmitted_timestamp_(0) {}
772 frame_retransmitted_(false) {}
773 772
774 private: 773 private:
775 Action OnSendRtp(const uint8_t* packet, size_t length) override { 774 Action OnSendRtp(const uint8_t* packet, size_t length) override {
776 rtc::CritScope lock(&crit_); 775 rtc::CritScope lock(&crit_);
777 RTPHeader header; 776 RTPHeader header;
778 EXPECT_TRUE(parser_->Parse(packet, length, &header)); 777 EXPECT_TRUE(parser_->Parse(packet, length, &header));
779 778
780 // Ignore padding-only packets over RTX. 779 // Ignore padding-only packets over RTX.
781 if (header.payloadType != payload_type_) { 780 if (header.payloadType != payload_type_) {
782 EXPECT_EQ(retransmission_ssrc_, header.ssrc); 781 EXPECT_EQ(retransmission_ssrc_, header.ssrc);
783 if (length == header.headerLength + header.paddingLength) 782 if (length == header.headerLength + header.paddingLength)
784 return SEND_PACKET; 783 return SEND_PACKET;
785 } 784 }
786 785
787 if (header.timestamp == retransmitted_timestamp_) { 786 if (header.timestamp == retransmitted_timestamp_) {
788 EXPECT_EQ(retransmission_ssrc_, header.ssrc); 787 EXPECT_EQ(retransmission_ssrc_, header.ssrc);
789 EXPECT_EQ(retransmission_payload_type_, header.payloadType); 788 EXPECT_EQ(retransmission_payload_type_, header.payloadType);
790 frame_retransmitted_ = true;
791 return SEND_PACKET; 789 return SEND_PACKET;
792 } 790 }
793 791
794 // Found the final packet of the frame to inflict loss to, drop this and 792 // Found the final packet of the frame to inflict loss to, drop this and
795 // expect a retransmission. 793 // expect a retransmission.
796 if (header.payloadType == payload_type_ && header.markerBit && 794 if (header.payloadType == payload_type_ && header.markerBit &&
797 ++marker_bits_observed_ == kDroppedFrameNumber) { 795 ++marker_bits_observed_ == kDroppedFrameNumber) {
798 // This should be the only dropped packet. 796 // This should be the only dropped packet.
799 EXPECT_EQ(0u, retransmitted_timestamp_); 797 EXPECT_EQ(0u, retransmitted_timestamp_);
800 retransmitted_timestamp_ = header.timestamp; 798 retransmitted_timestamp_ = header.timestamp;
799 if (std::find(rendered_timestamps_.begin(), rendered_timestamps_.end(),
800 retransmitted_timestamp_) != rendered_timestamps_.end()) {
801 // Frame was rendered before last packet was scheduled for sending.
802 // This is extremly rare but possible scenario because prober able to
803 // resend packet before it was send.
804 // TODO(danilchap): Remove this corner case when prober would not be
805 // able to sneak in between packet saved to history for resending and
806 // pacer notified about existance of that packet for sending.
807 // See https://bugs.chromium.org/p/webrtc/issues/detail?id=5540 for
808 // details.
809 observation_complete_.Set();
810 }
801 return DROP_PACKET; 811 return DROP_PACKET;
802 } 812 }
803 813
804 return SEND_PACKET; 814 return SEND_PACKET;
805 } 815 }
806 816
807 void FrameCallback(VideoFrame* frame) override { 817 void FrameCallback(VideoFrame* frame) override {
808 rtc::CritScope lock(&crit_); 818 rtc::CritScope lock(&crit_);
809 if (frame->timestamp() == retransmitted_timestamp_) { 819 if (frame->timestamp() == retransmitted_timestamp_)
810 EXPECT_TRUE(frame_retransmitted_);
811 observation_complete_.Set(); 820 observation_complete_.Set();
812 } 821 rendered_timestamps_.push_back(frame->timestamp());
813 } 822 }
814 823
815 void ModifyVideoConfigs( 824 void ModifyVideoConfigs(
816 VideoSendStream::Config* send_config, 825 VideoSendStream::Config* send_config,
817 std::vector<VideoReceiveStream::Config>* receive_configs, 826 std::vector<VideoReceiveStream::Config>* receive_configs,
818 VideoEncoderConfig* encoder_config) override { 827 VideoEncoderConfig* encoder_config) override {
819 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 828 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
820 (*receive_configs)[0].pre_render_callback = this; 829 (*receive_configs)[0].pre_render_callback = this;
821 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 830 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
822 831
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 } 874 }
866 875
867 rtc::CriticalSection crit_; 876 rtc::CriticalSection crit_;
868 const int payload_type_; 877 const int payload_type_;
869 const uint32_t retransmission_ssrc_; 878 const uint32_t retransmission_ssrc_;
870 const int retransmission_payload_type_; 879 const int retransmission_payload_type_;
871 std::unique_ptr<VideoEncoder> encoder_; 880 std::unique_ptr<VideoEncoder> encoder_;
872 const std::string payload_name_; 881 const std::string payload_name_;
873 int marker_bits_observed_; 882 int marker_bits_observed_;
874 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_); 883 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_);
875 bool frame_retransmitted_; 884 std::vector<uint32_t> rendered_timestamps_ GUARDED_BY(&crit_);
876 } test(enable_rtx, enable_red); 885 } test(enable_rtx, enable_red);
877 886
878 RunBaseTest(&test); 887 RunBaseTest(&test);
879 } 888 }
880 889
881 TEST_F(EndToEndTest, DecodesRetransmittedFrame) { 890 TEST_F(EndToEndTest, DecodesRetransmittedFrame) {
882 DecodesRetransmittedFrame(false, false); 891 DecodesRetransmittedFrame(false, false);
883 } 892 }
884 893
885 TEST_F(EndToEndTest, DecodesRetransmittedFrameOverRtx) { 894 TEST_F(EndToEndTest, DecodesRetransmittedFrameOverRtx) {
(...skipping 2750 matching lines...) Expand 10 before | Expand all | Expand 10 after
3636 private: 3645 private:
3637 bool video_observed_; 3646 bool video_observed_;
3638 bool audio_observed_; 3647 bool audio_observed_;
3639 SequenceNumberUnwrapper unwrapper_; 3648 SequenceNumberUnwrapper unwrapper_;
3640 std::set<int64_t> received_packet_ids_; 3649 std::set<int64_t> received_packet_ids_;
3641 } test; 3650 } test;
3642 3651
3643 RunBaseTest(&test); 3652 RunBaseTest(&test);
3644 } 3653 }
3645 } // namespace webrtc 3654 } // 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