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

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

Issue 2728103002: Fix flaky EndToEndTest.TransportSeqNumOnAudioAndVideo (Closed)
Patch Set: Name the kMinPacketsToWaitFor constant Created 3 years, 9 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 4007 matching lines...) Expand 10 before | Expand all | Expand 10 after
4018 FlexfecReceiveStream::Config default_receive_config(&rtcp_send_transport); 4018 FlexfecReceiveStream::Config default_receive_config(&rtcp_send_transport);
4019 EXPECT_EQ(-1, default_receive_config.payload_type) 4019 EXPECT_EQ(-1, default_receive_config.payload_type)
4020 << "Enabling FlexFEC requires rtpmap: flexfec negotiation."; 4020 << "Enabling FlexFEC requires rtpmap: flexfec negotiation.";
4021 EXPECT_EQ(0U, default_receive_config.remote_ssrc) 4021 EXPECT_EQ(0U, default_receive_config.remote_ssrc)
4022 << "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation."; 4022 << "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation.";
4023 EXPECT_TRUE(default_receive_config.protected_media_ssrcs.empty()) 4023 EXPECT_TRUE(default_receive_config.protected_media_ssrcs.empty())
4024 << "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation."; 4024 << "Enabling FlexFEC requires ssrc-group: FEC-FR negotiation.";
4025 } 4025 }
4026 4026
4027 TEST_P(EndToEndTest, TransportSeqNumOnAudioAndVideo) { 4027 TEST_P(EndToEndTest, TransportSeqNumOnAudioAndVideo) {
4028 static const int kExtensionId = 8; 4028 static constexpr int kExtensionId = 8;
4029 static constexpr size_t kMinPacketsToWaitFor = 50;
4029 class TransportSequenceNumberTest : public test::EndToEndTest { 4030 class TransportSequenceNumberTest : public test::EndToEndTest {
4030 public: 4031 public:
4031 TransportSequenceNumberTest() 4032 TransportSequenceNumberTest()
4032 : EndToEndTest(kDefaultTimeoutMs), 4033 : EndToEndTest(kDefaultTimeoutMs),
4033 video_observed_(false), 4034 video_observed_(false),
4034 audio_observed_(false) { 4035 audio_observed_(false) {
4035 parser_->RegisterRtpHeaderExtension(kRtpExtensionTransportSequenceNumber, 4036 parser_->RegisterRtpHeaderExtension(kRtpExtensionTransportSequenceNumber,
4036 kExtensionId); 4037 kExtensionId);
4037 } 4038 }
4038 4039
(...skipping 17 matching lines...) Expand all
4056 // Unwrap packet id and verify uniqueness. 4057 // Unwrap packet id and verify uniqueness.
4057 int64_t packet_id = 4058 int64_t packet_id =
4058 unwrapper_.Unwrap(header.extension.transportSequenceNumber); 4059 unwrapper_.Unwrap(header.extension.transportSequenceNumber);
4059 EXPECT_TRUE(received_packet_ids_.insert(packet_id).second); 4060 EXPECT_TRUE(received_packet_ids_.insert(packet_id).second);
4060 4061
4061 if (header.ssrc == kVideoSendSsrcs[0]) 4062 if (header.ssrc == kVideoSendSsrcs[0])
4062 video_observed_ = true; 4063 video_observed_ = true;
4063 if (header.ssrc == kAudioSendSsrc) 4064 if (header.ssrc == kAudioSendSsrc)
4064 audio_observed_ = true; 4065 audio_observed_ = true;
4065 if (audio_observed_ && video_observed_ && 4066 if (audio_observed_ && video_observed_ &&
4066 received_packet_ids_.size() == 50) { 4067 received_packet_ids_.size() >= kMinPacketsToWaitFor) {
4067 size_t packet_id_range = 4068 size_t packet_id_range =
4068 *received_packet_ids_.rbegin() - *received_packet_ids_.begin() + 1; 4069 *received_packet_ids_.rbegin() - *received_packet_ids_.begin() + 1;
4069 EXPECT_EQ(received_packet_ids_.size(), packet_id_range); 4070 EXPECT_EQ(received_packet_ids_.size(), packet_id_range);
4070 observation_complete_.Set(); 4071 observation_complete_.Set();
4071 } 4072 }
4072 return SEND_PACKET; 4073 return SEND_PACKET;
4073 } 4074 }
4074 4075
4075 void PerformTest() override { 4076 void PerformTest() override {
4076 EXPECT_TRUE(Wait()) << "Timed out while waiting for audio and video " 4077 EXPECT_TRUE(Wait()) << "Timed out while waiting for audio and video "
4077 "packets with transport sequence number."; 4078 "packets with transport sequence number.";
4079 // Double check conditions for successfull test to produce better error
4080 // message when this test fail.
4081 EXPECT_TRUE(video_observed_);
4082 EXPECT_TRUE(audio_observed_);
4083 EXPECT_GE(received_packet_ids_.size(), kMinPacketsToWaitFor);
4078 } 4084 }
4079 4085
4080 private: 4086 private:
4081 bool video_observed_; 4087 bool video_observed_;
4082 bool audio_observed_; 4088 bool audio_observed_;
4083 SequenceNumberUnwrapper unwrapper_; 4089 SequenceNumberUnwrapper unwrapper_;
4084 std::set<int64_t> received_packet_ids_; 4090 std::set<int64_t> received_packet_ids_;
4085 } test; 4091 } test;
4086 4092
4087 RunBaseTest(&test); 4093 RunBaseTest(&test);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
4181 std::unique_ptr<VideoEncoder> encoder_; 4187 std::unique_ptr<VideoEncoder> encoder_;
4182 std::unique_ptr<VideoDecoder> decoder_; 4188 std::unique_ptr<VideoDecoder> decoder_;
4183 rtc::CriticalSection crit_; 4189 rtc::CriticalSection crit_;
4184 int recorded_frames_ GUARDED_BY(crit_); 4190 int recorded_frames_ GUARDED_BY(crit_);
4185 } test(this); 4191 } test(this);
4186 4192
4187 RunBaseTest(&test); 4193 RunBaseTest(&test);
4188 } 4194 }
4189 4195
4190 } // namespace webrtc 4196 } // 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