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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 // TODO(brandtr): Move these FlexFEC tests when we have created | 539 // TODO(brandtr): Move these FlexFEC tests when we have created |
540 // FlexfecSendStream. | 540 // FlexfecSendStream. |
541 class FlexfecObserver : public test::EndToEndTest { | 541 class FlexfecObserver : public test::EndToEndTest { |
542 public: | 542 public: |
543 FlexfecObserver(bool header_extensions_enabled, | 543 FlexfecObserver(bool header_extensions_enabled, |
544 bool use_nack, | 544 bool use_nack, |
545 const std::string& codec) | 545 const std::string& codec) |
546 : EndToEndTest(VideoSendStreamTest::kDefaultTimeoutMs), | 546 : EndToEndTest(VideoSendStreamTest::kDefaultTimeoutMs), |
547 payload_name_(codec), | 547 payload_name_(codec), |
548 use_nack_(use_nack), | 548 use_nack_(use_nack), |
549 send_count_(0), | |
550 sent_media_(false), | 549 sent_media_(false), |
551 sent_flexfec_(false), | 550 sent_flexfec_(false), |
552 header_extensions_enabled_(header_extensions_enabled) { | 551 header_extensions_enabled_(header_extensions_enabled) { |
553 if (codec == "H264") { | 552 if (codec == "H264") { |
554 encoder_.reset(new test::FakeH264Encoder(Clock::GetRealTimeClock())); | 553 encoder_.reset(new test::FakeH264Encoder(Clock::GetRealTimeClock())); |
555 } else if (codec == "VP8") { | 554 } else if (codec == "VP8") { |
556 encoder_.reset(VP8Encoder::Create()); | 555 encoder_.reset(VP8Encoder::Create()); |
557 } else if (codec == "VP9") { | 556 } else if (codec == "VP9") { |
558 encoder_.reset(VP9Encoder::Create()); | 557 encoder_.reset(VP9Encoder::Create()); |
559 } else { | 558 } else { |
560 RTC_NOTREACHED(); | 559 RTC_NOTREACHED(); |
561 } | 560 } |
562 } | 561 } |
563 | 562 |
564 size_t GetNumFlexfecStreams() const override { return 1; } | 563 size_t GetNumFlexfecStreams() const override { return 1; } |
565 | 564 |
566 private: | 565 private: |
567 Action OnSendRtp(const uint8_t* packet, size_t length) override { | 566 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
568 RTPHeader header; | 567 RTPHeader header; |
569 EXPECT_TRUE(parser_->Parse(packet, length, &header)); | 568 EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
570 | 569 |
571 ++send_count_; | |
572 if (header.payloadType == VideoSendStreamTest::kFlexfecPayloadType) { | 570 if (header.payloadType == VideoSendStreamTest::kFlexfecPayloadType) { |
573 EXPECT_EQ(VideoSendStreamTest::kFlexfecSendSsrc, header.ssrc); | 571 EXPECT_EQ(VideoSendStreamTest::kFlexfecSendSsrc, header.ssrc); |
574 sent_flexfec_ = true; | 572 sent_flexfec_ = true; |
575 } else { | 573 } else { |
576 EXPECT_EQ(VideoSendStreamTest::kFakeVideoSendPayloadType, | 574 EXPECT_EQ(VideoSendStreamTest::kFakeVideoSendPayloadType, |
577 header.payloadType); | 575 header.payloadType); |
578 EXPECT_EQ(VideoSendStreamTest::kVideoSendSsrcs[0], header.ssrc); | 576 EXPECT_EQ(VideoSendStreamTest::kVideoSendSsrcs[0], header.ssrc); |
579 sent_media_ = true; | 577 sent_media_ = true; |
580 } | 578 } |
581 | 579 |
582 if (header_extensions_enabled_) { | 580 if (header_extensions_enabled_) { |
583 EXPECT_TRUE(header.extension.hasAbsoluteSendTime); | 581 EXPECT_TRUE(header.extension.hasAbsoluteSendTime); |
584 EXPECT_TRUE(header.extension.hasTransmissionTimeOffset); | 582 EXPECT_TRUE(header.extension.hasTransmissionTimeOffset); |
585 EXPECT_TRUE(header.extension.hasTransportSequenceNumber); | 583 EXPECT_TRUE(header.extension.hasTransportSequenceNumber); |
586 } | 584 } |
587 | 585 |
588 if (send_count_ > 100 && sent_media_ && sent_flexfec_) { | 586 if (sent_media_ && sent_flexfec_) { |
589 observation_complete_.Set(); | 587 observation_complete_.Set(); |
590 } | 588 } |
591 | 589 |
592 return SEND_PACKET; | 590 return SEND_PACKET; |
593 } | 591 } |
594 | 592 |
595 test::PacketTransport* CreateSendTransport(Call* sender_call) override { | 593 test::PacketTransport* CreateSendTransport(Call* sender_call) override { |
596 // At low RTT (< kLowRttNackMs) -> NACK only, no FEC. | 594 // At low RTT (< kLowRttNackMs) -> NACK only, no FEC. |
597 // Therefore we need some network delay. | 595 // Therefore we need some network delay. |
598 const int kNetworkDelayMs = 100; | 596 const int kNetworkDelayMs = 100; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 628 |
631 void PerformTest() override { | 629 void PerformTest() override { |
632 EXPECT_TRUE(Wait()) | 630 EXPECT_TRUE(Wait()) |
633 << "Timed out waiting for FlexFEC and/or media packets."; | 631 << "Timed out waiting for FlexFEC and/or media packets."; |
634 } | 632 } |
635 | 633 |
636 std::unique_ptr<internal::TransportAdapter> transport_adapter_; | 634 std::unique_ptr<internal::TransportAdapter> transport_adapter_; |
637 std::unique_ptr<VideoEncoder> encoder_; | 635 std::unique_ptr<VideoEncoder> encoder_; |
638 const std::string payload_name_; | 636 const std::string payload_name_; |
639 const bool use_nack_; | 637 const bool use_nack_; |
640 int send_count_; | |
641 bool sent_media_; | 638 bool sent_media_; |
642 bool sent_flexfec_; | 639 bool sent_flexfec_; |
643 bool header_extensions_enabled_; | 640 bool header_extensions_enabled_; |
644 }; | 641 }; |
645 | 642 |
646 TEST_F(VideoSendStreamTest, SupportsFlexfecWithRtpExtensionsVp8) { | 643 TEST_F(VideoSendStreamTest, SupportsFlexfecWithRtpExtensionsVp8) { |
647 FlexfecObserver test(true, false, "VP8"); | 644 FlexfecObserver test(true, false, "VP8"); |
648 RunBaseTest(&test); | 645 RunBaseTest(&test); |
649 } | 646 } |
650 | 647 |
(...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3168 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { | 3165 RequestSourceRotateIfVideoOrientationExtensionNotSupported) { |
3169 TestRequestSourceRotateVideo(false); | 3166 TestRequestSourceRotateVideo(false); |
3170 } | 3167 } |
3171 | 3168 |
3172 TEST_F(VideoSendStreamTest, | 3169 TEST_F(VideoSendStreamTest, |
3173 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { | 3170 DoNotRequestsRotationIfVideoOrientationExtensionSupported) { |
3174 TestRequestSourceRotateVideo(true); | 3171 TestRequestSourceRotateVideo(true); |
3175 } | 3172 } |
3176 | 3173 |
3177 } // namespace webrtc | 3174 } // namespace webrtc |
OLD | NEW |