| 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> | 10 #include <algorithm> |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 } state_; | 635 } state_; |
| 636 | 636 |
| 637 void ModifyVideoConfigs( | 637 void ModifyVideoConfigs( |
| 638 VideoSendStream::Config* send_config, | 638 VideoSendStream::Config* send_config, |
| 639 std::vector<VideoReceiveStream::Config>* receive_configs, | 639 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 640 VideoEncoderConfig* encoder_config) override { | 640 VideoEncoderConfig* encoder_config) override { |
| 641 // TODO(pbos): Run this test with combined NACK/FEC enabled as well. | 641 // TODO(pbos): Run this test with combined NACK/FEC enabled as well. |
| 642 // int rtp_history_ms = 1000; | 642 // int rtp_history_ms = 1000; |
| 643 // (*receive_configs)[0].rtp.nack.rtp_history_ms = rtp_history_ms; | 643 // (*receive_configs)[0].rtp.nack.rtp_history_ms = rtp_history_ms; |
| 644 // send_config->rtp.nack.rtp_history_ms = rtp_history_ms; | 644 // send_config->rtp.nack.rtp_history_ms = rtp_history_ms; |
| 645 send_config->rtp.fec.red_payload_type = kRedPayloadType; | 645 send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 646 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 646 send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
| 647 | 647 |
| 648 (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; | 648 (*receive_configs)[0].rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 649 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 649 (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
| 650 (*receive_configs)[0].renderer = this; | 650 (*receive_configs)[0].renderer = this; |
| 651 } | 651 } |
| 652 | 652 |
| 653 void PerformTest() override { | 653 void PerformTest() override { |
| 654 EXPECT_TRUE(Wait()) | 654 EXPECT_TRUE(Wait()) |
| 655 << "Timed out waiting for dropped frames frames to be rendered."; | 655 << "Timed out waiting for dropped frames frames to be rendered."; |
| 656 } | 656 } |
| 657 | 657 |
| 658 rtc::CriticalSection crit_; | 658 rtc::CriticalSection crit_; |
| 659 std::set<uint32_t> protected_sequence_numbers_ GUARDED_BY(crit_); | 659 std::set<uint32_t> protected_sequence_numbers_ GUARDED_BY(crit_); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 config.bitrate_config.min_bitrate_bps = kMinBitrateBps; | 776 config.bitrate_config.min_bitrate_bps = kMinBitrateBps; |
| 777 return config; | 777 return config; |
| 778 } | 778 } |
| 779 | 779 |
| 780 void ModifyVideoConfigs( | 780 void ModifyVideoConfigs( |
| 781 VideoSendStream::Config* send_config, | 781 VideoSendStream::Config* send_config, |
| 782 std::vector<VideoReceiveStream::Config>* receive_configs, | 782 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 783 VideoEncoderConfig* encoder_config) override { | 783 VideoEncoderConfig* encoder_config) override { |
| 784 // Configure hybrid NACK/FEC. | 784 // Configure hybrid NACK/FEC. |
| 785 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 785 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 786 send_config->rtp.fec.red_payload_type = kRedPayloadType; | 786 send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 787 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 787 send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
| 788 // Set codec to VP8, otherwise NACK/FEC hybrid will be disabled. | 788 // Set codec to VP8, otherwise NACK/FEC hybrid will be disabled. |
| 789 send_config->encoder_settings.encoder = encoder_.get(); | 789 send_config->encoder_settings.encoder = encoder_.get(); |
| 790 send_config->encoder_settings.payload_name = "VP8"; | 790 send_config->encoder_settings.payload_name = "VP8"; |
| 791 send_config->encoder_settings.payload_type = kFakeVideoSendPayloadType; | 791 send_config->encoder_settings.payload_type = kFakeVideoSendPayloadType; |
| 792 | 792 |
| 793 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 793 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 794 (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; | 794 (*receive_configs)[0].rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 795 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 795 (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
| 796 | 796 |
| 797 (*receive_configs)[0].decoders.resize(1); | 797 (*receive_configs)[0].decoders.resize(1); |
| 798 (*receive_configs)[0].decoders[0].payload_type = | 798 (*receive_configs)[0].decoders[0].payload_type = |
| 799 send_config->encoder_settings.payload_type; | 799 send_config->encoder_settings.payload_type; |
| 800 (*receive_configs)[0].decoders[0].payload_name = | 800 (*receive_configs)[0].decoders[0].payload_name = |
| 801 send_config->encoder_settings.payload_name; | 801 send_config->encoder_settings.payload_name; |
| 802 (*receive_configs)[0].decoders[0].decoder = decoder_.get(); | 802 (*receive_configs)[0].decoders[0].decoder = decoder_.get(); |
| 803 } | 803 } |
| 804 | 804 |
| 805 void PerformTest() override { | 805 void PerformTest() override { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 897 |
| 898 void ModifyVideoConfigs( | 898 void ModifyVideoConfigs( |
| 899 VideoSendStream::Config* send_config, | 899 VideoSendStream::Config* send_config, |
| 900 std::vector<VideoReceiveStream::Config>* receive_configs, | 900 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 901 VideoEncoderConfig* encoder_config) override { | 901 VideoEncoderConfig* encoder_config) override { |
| 902 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 902 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 903 (*receive_configs)[0].pre_render_callback = this; | 903 (*receive_configs)[0].pre_render_callback = this; |
| 904 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 904 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 905 | 905 |
| 906 if (payload_type_ == kRedPayloadType) { | 906 if (payload_type_ == kRedPayloadType) { |
| 907 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 907 send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
| 908 send_config->rtp.fec.red_payload_type = kRedPayloadType; | 908 send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 909 if (retransmission_ssrc_ == kSendRtxSsrcs[0]) | 909 if (retransmission_ssrc_ == kSendRtxSsrcs[0]) |
| 910 send_config->rtp.fec.red_rtx_payload_type = kRtxRedPayloadType; | 910 send_config->rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType; |
| 911 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = | 911 (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = |
| 912 send_config->rtp.fec.ulpfec_payload_type; | 912 send_config->rtp.ulpfec.ulpfec_payload_type; |
| 913 (*receive_configs)[0].rtp.fec.red_payload_type = | 913 (*receive_configs)[0].rtp.ulpfec.red_payload_type = |
| 914 send_config->rtp.fec.red_payload_type; | 914 send_config->rtp.ulpfec.red_payload_type; |
| 915 (*receive_configs)[0].rtp.fec.red_rtx_payload_type = | 915 (*receive_configs)[0].rtp.ulpfec.red_rtx_payload_type = |
| 916 send_config->rtp.fec.red_rtx_payload_type; | 916 send_config->rtp.ulpfec.red_rtx_payload_type; |
| 917 } | 917 } |
| 918 | 918 |
| 919 if (retransmission_ssrc_ == kSendRtxSsrcs[0]) { | 919 if (retransmission_ssrc_ == kSendRtxSsrcs[0]) { |
| 920 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); | 920 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); |
| 921 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; | 921 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; |
| 922 (*receive_configs)[0].rtp.rtx[payload_type_].ssrc = kSendRtxSsrcs[0]; | 922 (*receive_configs)[0].rtp.rtx[payload_type_].ssrc = kSendRtxSsrcs[0]; |
| 923 (*receive_configs)[0].rtp.rtx[payload_type_].payload_type = | 923 (*receive_configs)[0].rtp.rtx[payload_type_].payload_type = |
| 924 kSendRtxPayloadType; | 924 kSendRtxPayloadType; |
| 925 } | 925 } |
| 926 // Configure encoding and decoding with VP8, since generic packetization | 926 // Configure encoding and decoding with VP8, since generic packetization |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 send_config->rtp.extensions.push_back(RtpExtension( | 2155 send_config->rtp.extensions.push_back(RtpExtension( |
| 2156 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); | 2156 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
| 2157 (*receive_configs)[0].rtp.extensions.push_back(RtpExtension( | 2157 (*receive_configs)[0].rtp.extensions.push_back(RtpExtension( |
| 2158 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); | 2158 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); |
| 2159 // NACK | 2159 // NACK |
| 2160 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 2160 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 2161 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 2161 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 2162 (*receive_configs)[0].renderer = this; | 2162 (*receive_configs)[0].renderer = this; |
| 2163 // FEC | 2163 // FEC |
| 2164 if (use_red_) { | 2164 if (use_red_) { |
| 2165 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 2165 send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
| 2166 send_config->rtp.fec.red_payload_type = kRedPayloadType; | 2166 send_config->rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 2167 send_config->encoder_settings.encoder = vp8_encoder_.get(); | 2167 send_config->encoder_settings.encoder = vp8_encoder_.get(); |
| 2168 send_config->encoder_settings.payload_name = "VP8"; | 2168 send_config->encoder_settings.payload_name = "VP8"; |
| 2169 (*receive_configs)[0].decoders[0].payload_name = "VP8"; | 2169 (*receive_configs)[0].decoders[0].payload_name = "VP8"; |
| 2170 (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; | 2170 (*receive_configs)[0].rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 2171 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 2171 (*receive_configs)[0].rtp.ulpfec.ulpfec_payload_type = |
| 2172 kUlpfecPayloadType; |
| 2172 } | 2173 } |
| 2173 // RTX | 2174 // RTX |
| 2174 if (use_rtx_) { | 2175 if (use_rtx_) { |
| 2175 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); | 2176 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); |
| 2176 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; | 2177 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; |
| 2177 (*receive_configs)[0].rtp.rtx[kFakeVideoSendPayloadType].ssrc = | 2178 (*receive_configs)[0].rtp.rtx[kFakeVideoSendPayloadType].ssrc = |
| 2178 kSendRtxSsrcs[0]; | 2179 kSendRtxSsrcs[0]; |
| 2179 (*receive_configs)[0].rtp.rtx[kFakeVideoSendPayloadType].payload_type = | 2180 (*receive_configs)[0].rtp.rtx[kFakeVideoSendPayloadType].payload_type = |
| 2180 kSendRtxPayloadType; | 2181 kSendRtxPayloadType; |
| 2181 } | 2182 } |
| (...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3708 TEST_F(EndToEndTest, NewVideoReceiveStreamsIgnoreAudioNetworkDown) { | 3709 TEST_F(EndToEndTest, NewVideoReceiveStreamsIgnoreAudioNetworkDown) { |
| 3709 RequiredTransport transport(false /*rtp*/, true /*rtcp*/); | 3710 RequiredTransport transport(false /*rtp*/, true /*rtcp*/); |
| 3710 VerifyNewVideoReceiveStreamsRespectNetworkState(MediaType::AUDIO, &transport); | 3711 VerifyNewVideoReceiveStreamsRespectNetworkState(MediaType::AUDIO, &transport); |
| 3711 } | 3712 } |
| 3712 | 3713 |
| 3713 void VerifyEmptyNackConfig(const NackConfig& config) { | 3714 void VerifyEmptyNackConfig(const NackConfig& config) { |
| 3714 EXPECT_EQ(0, config.rtp_history_ms) | 3715 EXPECT_EQ(0, config.rtp_history_ms) |
| 3715 << "Enabling NACK requires rtcp-fb: nack negotiation."; | 3716 << "Enabling NACK requires rtcp-fb: nack negotiation."; |
| 3716 } | 3717 } |
| 3717 | 3718 |
| 3718 void VerifyEmptyFecConfig(const FecConfig& config) { | 3719 void VerifyEmptyUlpfecConfig(const UlpfecConfig& config) { |
| 3719 EXPECT_EQ(-1, config.ulpfec_payload_type) | 3720 EXPECT_EQ(-1, config.ulpfec_payload_type) |
| 3720 << "Enabling FEC requires rtpmap: ulpfec negotiation."; | 3721 << "Enabling FEC requires rtpmap: ulpfec negotiation."; |
| 3721 EXPECT_EQ(-1, config.red_payload_type) | 3722 EXPECT_EQ(-1, config.red_payload_type) |
| 3722 << "Enabling FEC requires rtpmap: red negotiation."; | 3723 << "Enabling FEC requires rtpmap: red negotiation."; |
| 3723 EXPECT_EQ(-1, config.red_rtx_payload_type) | 3724 EXPECT_EQ(-1, config.red_rtx_payload_type) |
| 3724 << "Enabling RTX in FEC requires rtpmap: rtx negotiation."; | 3725 << "Enabling RTX in FEC requires rtpmap: rtx negotiation."; |
| 3725 } | 3726 } |
| 3726 | 3727 |
| 3727 TEST_F(EndToEndTest, VerifyDefaultSendConfigParameters) { | 3728 TEST_F(EndToEndTest, VerifyDefaultSendConfigParameters) { |
| 3728 VideoSendStream::Config default_send_config(nullptr); | 3729 VideoSendStream::Config default_send_config(nullptr); |
| 3729 EXPECT_EQ(0, default_send_config.rtp.nack.rtp_history_ms) | 3730 EXPECT_EQ(0, default_send_config.rtp.nack.rtp_history_ms) |
| 3730 << "Enabling NACK require rtcp-fb: nack negotiation."; | 3731 << "Enabling NACK require rtcp-fb: nack negotiation."; |
| 3731 EXPECT_TRUE(default_send_config.rtp.rtx.ssrcs.empty()) | 3732 EXPECT_TRUE(default_send_config.rtp.rtx.ssrcs.empty()) |
| 3732 << "Enabling RTX requires rtpmap: rtx negotiation."; | 3733 << "Enabling RTX requires rtpmap: rtx negotiation."; |
| 3733 EXPECT_TRUE(default_send_config.rtp.extensions.empty()) | 3734 EXPECT_TRUE(default_send_config.rtp.extensions.empty()) |
| 3734 << "Enabling RTP extensions require negotiation."; | 3735 << "Enabling RTP extensions require negotiation."; |
| 3735 | 3736 |
| 3736 VerifyEmptyNackConfig(default_send_config.rtp.nack); | 3737 VerifyEmptyNackConfig(default_send_config.rtp.nack); |
| 3737 VerifyEmptyFecConfig(default_send_config.rtp.fec); | 3738 VerifyEmptyUlpfecConfig(default_send_config.rtp.ulpfec); |
| 3738 } | 3739 } |
| 3739 | 3740 |
| 3740 TEST_F(EndToEndTest, VerifyDefaultReceiveConfigParameters) { | 3741 TEST_F(EndToEndTest, VerifyDefaultReceiveConfigParameters) { |
| 3741 VideoReceiveStream::Config default_receive_config(nullptr); | 3742 VideoReceiveStream::Config default_receive_config(nullptr); |
| 3742 EXPECT_EQ(RtcpMode::kCompound, default_receive_config.rtp.rtcp_mode) | 3743 EXPECT_EQ(RtcpMode::kCompound, default_receive_config.rtp.rtcp_mode) |
| 3743 << "Reduced-size RTCP require rtcp-rsize to be negotiated."; | 3744 << "Reduced-size RTCP require rtcp-rsize to be negotiated."; |
| 3744 EXPECT_FALSE(default_receive_config.rtp.remb) | 3745 EXPECT_FALSE(default_receive_config.rtp.remb) |
| 3745 << "REMB require rtcp-fb: goog-remb to be negotiated."; | 3746 << "REMB require rtcp-fb: goog-remb to be negotiated."; |
| 3746 EXPECT_FALSE( | 3747 EXPECT_FALSE( |
| 3747 default_receive_config.rtp.rtcp_xr.receiver_reference_time_report) | 3748 default_receive_config.rtp.rtcp_xr.receiver_reference_time_report) |
| 3748 << "RTCP XR settings require rtcp-xr to be negotiated."; | 3749 << "RTCP XR settings require rtcp-xr to be negotiated."; |
| 3749 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) | 3750 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) |
| 3750 << "Enabling RTX requires rtpmap: rtx negotiation."; | 3751 << "Enabling RTX requires rtpmap: rtx negotiation."; |
| 3751 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) | 3752 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) |
| 3752 << "Enabling RTP extensions require negotiation."; | 3753 << "Enabling RTP extensions require negotiation."; |
| 3753 | 3754 |
| 3754 VerifyEmptyNackConfig(default_receive_config.rtp.nack); | 3755 VerifyEmptyNackConfig(default_receive_config.rtp.nack); |
| 3755 VerifyEmptyFecConfig(default_receive_config.rtp.fec); | 3756 VerifyEmptyUlpfecConfig(default_receive_config.rtp.ulpfec); |
| 3756 } | 3757 } |
| 3757 | 3758 |
| 3758 TEST_F(EndToEndTest, TransportSeqNumOnAudioAndVideo) { | 3759 TEST_F(EndToEndTest, TransportSeqNumOnAudioAndVideo) { |
| 3759 static const int kExtensionId = 8; | 3760 static const int kExtensionId = 8; |
| 3760 class TransportSequenceNumberTest : public test::EndToEndTest { | 3761 class TransportSequenceNumberTest : public test::EndToEndTest { |
| 3761 public: | 3762 public: |
| 3762 TransportSequenceNumberTest() | 3763 TransportSequenceNumberTest() |
| 3763 : EndToEndTest(kDefaultTimeoutMs), | 3764 : EndToEndTest(kDefaultTimeoutMs), |
| 3764 video_observed_(false), | 3765 video_observed_(false), |
| 3765 audio_observed_(false) { | 3766 audio_observed_(false) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3922 std::unique_ptr<VideoEncoder> encoder_; | 3923 std::unique_ptr<VideoEncoder> encoder_; |
| 3923 std::unique_ptr<VideoDecoder> decoder_; | 3924 std::unique_ptr<VideoDecoder> decoder_; |
| 3924 rtc::CriticalSection crit_; | 3925 rtc::CriticalSection crit_; |
| 3925 int recorded_frames_ GUARDED_BY(crit_); | 3926 int recorded_frames_ GUARDED_BY(crit_); |
| 3926 } test(this); | 3927 } test(this); |
| 3927 | 3928 |
| 3928 RunBaseTest(&test); | 3929 RunBaseTest(&test); |
| 3929 } | 3930 } |
| 3930 | 3931 |
| 3931 } // namespace webrtc | 3932 } // namespace webrtc |
| OLD | NEW |