OLD | NEW |
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> // max | 10 #include <algorithm> // max |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 }; | 351 }; |
352 | 352 |
353 class UlpfecObserver : public test::EndToEndTest { | 353 class UlpfecObserver : public test::EndToEndTest { |
354 public: | 354 public: |
355 UlpfecObserver(bool header_extensions_enabled, | 355 UlpfecObserver(bool header_extensions_enabled, |
356 bool use_nack, | 356 bool use_nack, |
357 bool expect_red, | 357 bool expect_red, |
358 bool expect_ulpfec, | 358 bool expect_ulpfec, |
359 const std::string& codec, | 359 const std::string& codec, |
360 VideoEncoder* encoder) | 360 VideoEncoder* encoder) |
361 : EndToEndTest(VideoSendStreamTest::kDefaultTimeoutMs), | 361 : EndToEndTest(kTimeoutMs), |
362 encoder_(encoder), | 362 encoder_(encoder), |
363 payload_name_(codec), | 363 payload_name_(codec), |
364 use_nack_(use_nack), | 364 use_nack_(use_nack), |
365 expect_red_(expect_red), | 365 expect_red_(expect_red), |
366 expect_ulpfec_(expect_ulpfec), | 366 expect_ulpfec_(expect_ulpfec), |
367 sent_media_(false), | 367 sent_media_(false), |
368 sent_ulpfec_(false), | 368 sent_ulpfec_(false), |
369 header_extensions_enabled_(header_extensions_enabled) {} | 369 header_extensions_enabled_(header_extensions_enabled) {} |
370 | 370 |
| 371 // Some of the test cases are expected to time out and thus we are using |
| 372 // a shorter timeout window than the default here. |
| 373 static constexpr size_t kTimeoutMs = 10000; |
| 374 |
371 private: | 375 private: |
372 Action OnSendRtp(const uint8_t* packet, size_t length) override { | 376 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
373 RTPHeader header; | 377 RTPHeader header; |
374 EXPECT_TRUE(parser_->Parse(packet, length, &header)); | 378 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
375 | 379 |
376 int encapsulated_payload_type = -1; | 380 int encapsulated_payload_type = -1; |
377 if (header.payloadType == VideoSendStreamTest::kRedPayloadType) { | 381 if (header.payloadType == VideoSendStreamTest::kRedPayloadType) { |
378 EXPECT_TRUE(expect_red_); | 382 EXPECT_TRUE(expect_red_); |
379 encapsulated_payload_type = static_cast<int>(packet[header.headerLength]); | 383 encapsulated_payload_type = static_cast<int>(packet[header.headerLength]); |
380 if (encapsulated_payload_type != | 384 if (encapsulated_payload_type != |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 if (encapsulated_payload_type != -1) { | 418 if (encapsulated_payload_type != -1) { |
415 if (encapsulated_payload_type == | 419 if (encapsulated_payload_type == |
416 VideoSendStreamTest::kUlpfecPayloadType) { | 420 VideoSendStreamTest::kUlpfecPayloadType) { |
417 EXPECT_TRUE(expect_ulpfec_); | 421 EXPECT_TRUE(expect_ulpfec_); |
418 sent_ulpfec_ = true; | 422 sent_ulpfec_ = true; |
419 } else { | 423 } else { |
420 sent_media_ = true; | 424 sent_media_ = true; |
421 } | 425 } |
422 } | 426 } |
423 | 427 |
424 if (sent_media_) { | 428 if (sent_media_ && sent_ulpfec_) { |
425 if (sent_ulpfec_ || !expect_ulpfec_) | 429 observation_complete_.Set(); |
426 observation_complete_.Set(); | |
427 } | 430 } |
428 | 431 |
429 prev_header_ = header; | 432 prev_header_ = header; |
430 | 433 |
431 return SEND_PACKET; | 434 return SEND_PACKET; |
432 } | 435 } |
433 | 436 |
434 test::PacketTransport* CreateSendTransport(Call* sender_call) override { | 437 test::PacketTransport* CreateSendTransport(Call* sender_call) override { |
435 // At low RTT (< kLowRttNackMs) -> NACK only, no FEC. | 438 // At low RTT (< kLowRttNackMs) -> NACK only, no FEC. |
436 // Configure some network delay. | 439 // Configure some network delay. |
(...skipping 30 matching lines...) Expand all Loading... |
467 RtpExtension(RtpExtension::kTransportSequenceNumberUri, | 470 RtpExtension(RtpExtension::kTransportSequenceNumberUri, |
468 test::kTransportSequenceNumberExtensionId)); | 471 test::kTransportSequenceNumberExtensionId)); |
469 } | 472 } |
470 (*receive_configs)[0].rtp.ulpfec.red_payload_type = | 473 (*receive_configs)[0].rtp.ulpfec.red_payload_type = |
471 send_config->rtp.ulpfec.red_payload_type; | 474 send_config->rtp.ulpfec.red_payload_type; |
472 (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = | 475 (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = |
473 send_config->rtp.ulpfec.ulpfec_payload_type; | 476 send_config->rtp.ulpfec.ulpfec_payload_type; |
474 } | 477 } |
475 | 478 |
476 void PerformTest() override { | 479 void PerformTest() override { |
477 EXPECT_TRUE(Wait()) << "Timed out waiting for ULPFEC and/or media packets."; | 480 EXPECT_EQ(expect_ulpfec_, Wait()) |
| 481 << "Timed out waiting for ULPFEC and/or media packets."; |
478 } | 482 } |
479 | 483 |
480 std::unique_ptr<internal::TransportAdapter> transport_adapter_; | 484 std::unique_ptr<internal::TransportAdapter> transport_adapter_; |
481 VideoEncoder* const encoder_; | 485 VideoEncoder* const encoder_; |
482 std::string payload_name_; | 486 std::string payload_name_; |
483 const bool use_nack_; | 487 const bool use_nack_; |
484 const bool expect_red_; | 488 const bool expect_red_; |
485 const bool expect_ulpfec_; | 489 const bool expect_ulpfec_; |
486 bool sent_media_; | 490 bool sent_media_; |
487 bool sent_ulpfec_; | 491 bool sent_ulpfec_; |
(...skipping 2738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3226 private: | 3230 private: |
3227 Call* call_; | 3231 Call* call_; |
3228 rtc::CriticalSection crit_; | 3232 rtc::CriticalSection crit_; |
3229 uint32_t max_bitrate_kbps_ GUARDED_BY(&crit_); | 3233 uint32_t max_bitrate_kbps_ GUARDED_BY(&crit_); |
3230 } test; | 3234 } test; |
3231 | 3235 |
3232 RunBaseTest(&test); | 3236 RunBaseTest(&test); |
3233 } | 3237 } |
3234 | 3238 |
3235 } // namespace webrtc | 3239 } // namespace webrtc |
OLD | NEW |