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

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

Issue 1269743004: Fix race condition in EndToEndTest.AssignsTransportSequenceNumbers (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 parser_(RtpHeaderParser::Create()), 1335 parser_(RtpHeaderParser::Create()),
1336 last_seq_(0), 1336 last_seq_(0),
1337 padding_observed_(false), 1337 padding_observed_(false),
1338 rtx_padding_observed_(false) { 1338 rtx_padding_observed_(false) {
1339 parser_->RegisterRtpHeaderExtension(kRtpExtensionTransportSequenceNumber, 1339 parser_->RegisterRtpHeaderExtension(kRtpExtensionTransportSequenceNumber,
1340 kExtensionId); 1340 kExtensionId);
1341 } 1341 }
1342 virtual ~RtpExtensionHeaderObserver() {} 1342 virtual ~RtpExtensionHeaderObserver() {}
1343 1343
1344 bool SendRtp(const uint8_t* data, size_t length) override { 1344 bool SendRtp(const uint8_t* data, size_t length) override {
1345 if (IsDone())
1346 return false;
1347
1345 RTPHeader header; 1348 RTPHeader header;
1346 EXPECT_TRUE(parser_->Parse(data, length, &header)); 1349 EXPECT_TRUE(parser_->Parse(data, length, &header));
1347 if (header.extension.hasTransportSequenceNumber) { 1350 if (header.extension.hasTransportSequenceNumber) {
1348 if (!streams_observed_.empty()) { 1351 if (!streams_observed_.empty()) {
1349 EXPECT_EQ(static_cast<uint16_t>(last_seq_ + 1), 1352 EXPECT_EQ(static_cast<uint16_t>(last_seq_ + 1),
1350 header.extension.transportSequenceNumber); 1353 header.extension.transportSequenceNumber);
1351 } 1354 }
1352 last_seq_ = header.extension.transportSequenceNumber; 1355 last_seq_ = header.extension.transportSequenceNumber;
1353 1356
1354 size_t payload_length = 1357 size_t payload_length =
1355 length - (header.headerLength + header.paddingLength); 1358 length - (header.headerLength + header.paddingLength);
1356 if (payload_length == 0) { 1359 if (payload_length == 0) {
1357 padding_observed_ = true; 1360 padding_observed_ = true;
1358 } else if (header.payloadType == kSendRtxPayloadType) { 1361 } else if (header.payloadType == kSendRtxPayloadType) {
1359 rtx_padding_observed_ = true; 1362 rtx_padding_observed_ = true;
1360 } else { 1363 } else {
1361 streams_observed_.insert(header.ssrc); 1364 streams_observed_.insert(header.ssrc);
1362 } 1365 }
1363 1366
1364 if (streams_observed_.size() == MultiStreamTest::kNumStreams && 1367 if (IsDone())
1365 padding_observed_ && rtx_padding_observed_) {
1366 done_->Set(); 1368 done_->Set();
1367 }
1368 } 1369 }
1369 return test::DirectTransport::SendRtp(data, length); 1370 return test::DirectTransport::SendRtp(data, length);
1370 } 1371 }
1371 1372
1373 bool IsDone() {
1374 return streams_observed_.size() == MultiStreamTest::kNumStreams &&
1375 padding_observed_ && rtx_padding_observed_;
1376 }
1377
1372 EventTypeWrapper Wait() { return done_->Wait(kDefaultTimeoutMs); } 1378 EventTypeWrapper Wait() { return done_->Wait(kDefaultTimeoutMs); }
1373 1379
1374 rtc::scoped_ptr<EventWrapper> done_; 1380 rtc::scoped_ptr<EventWrapper> done_;
1375 rtc::scoped_ptr<RtpHeaderParser> parser_; 1381 rtc::scoped_ptr<RtpHeaderParser> parser_;
1376 uint16_t last_seq_; 1382 uint16_t last_seq_;
1377 std::set<uint32_t> streams_observed_; 1383 std::set<uint32_t> streams_observed_;
1378 bool padding_observed_; 1384 bool padding_observed_;
1379 bool rtx_padding_observed_; 1385 bool rtx_padding_observed_;
1380 }; 1386 };
1381 1387
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) 3051 EXPECT_TRUE(default_receive_config.rtp.rtx.empty())
3046 << "Enabling RTX requires rtpmap: rtx negotiation."; 3052 << "Enabling RTX requires rtpmap: rtx negotiation.";
3047 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) 3053 EXPECT_TRUE(default_receive_config.rtp.extensions.empty())
3048 << "Enabling RTP extensions require negotiation."; 3054 << "Enabling RTP extensions require negotiation.";
3049 3055
3050 VerifyEmptyNackConfig(default_receive_config.rtp.nack); 3056 VerifyEmptyNackConfig(default_receive_config.rtp.nack);
3051 VerifyEmptyFecConfig(default_receive_config.rtp.fec); 3057 VerifyEmptyFecConfig(default_receive_config.rtp.fec);
3052 } 3058 }
3053 3059
3054 } // namespace webrtc 3060 } // 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