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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 }; | 115 }; |
116 | 116 |
117 void DecodesRetransmittedFrame(bool enable_rtx, bool enable_red); | 117 void DecodesRetransmittedFrame(bool enable_rtx, bool enable_red); |
118 void ReceivesPliAndRecovers(int rtp_history_ms); | 118 void ReceivesPliAndRecovers(int rtp_history_ms); |
119 void RespectsRtcpMode(RtcpMode rtcp_mode); | 119 void RespectsRtcpMode(RtcpMode rtcp_mode); |
120 void TestXrReceiverReferenceTimeReport(bool enable_rrtr); | 120 void TestXrReceiverReferenceTimeReport(bool enable_rrtr); |
121 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); | 121 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); |
122 void TestRtpStatePreservation(bool use_rtx, bool provoke_rtcpsr_before_rtp); | 122 void TestRtpStatePreservation(bool use_rtx, bool provoke_rtcpsr_before_rtp); |
123 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); | 123 void VerifyHistogramStats(bool use_rtx, bool use_red, bool screenshare); |
124 void VerifyNewVideoSendStreamsRespectNetworkState( | 124 void VerifyNewVideoSendStreamsRespectNetworkState( |
125 MediaType network_to_bring_up, | 125 MediaType network_to_bring_down, |
126 VideoEncoder* encoder, | 126 VideoEncoder* encoder, |
127 Transport* transport); | 127 Transport* transport); |
128 void VerifyNewVideoReceiveStreamsRespectNetworkState( | 128 void VerifyNewVideoReceiveStreamsRespectNetworkState( |
129 MediaType network_to_bring_up, | 129 MediaType network_to_bring_down, |
130 Transport* transport); | 130 Transport* transport); |
131 }; | 131 }; |
132 | 132 |
133 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { | 133 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { |
134 CreateCalls(Call::Config(&event_log_), Call::Config(&event_log_)); | 134 CreateCalls(Call::Config(&event_log_), Call::Config(&event_log_)); |
135 | 135 |
136 test::NullTransport transport; | 136 test::NullTransport transport; |
137 CreateSendConfig(1, 0, 0, &transport); | 137 CreateSendConfig(1, 0, 0, &transport); |
138 CreateMatchingReceiveConfigs(&transport); | 138 CreateMatchingReceiveConfigs(&transport); |
139 | 139 |
(...skipping 3440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3580 break; | 3580 break; |
3581 } | 3581 } |
3582 SleepMs(10); | 3582 SleepMs(10); |
3583 } | 3583 } |
3584 | 3584 |
3585 Stop(); | 3585 Stop(); |
3586 DestroyStreams(); | 3586 DestroyStreams(); |
3587 } | 3587 } |
3588 | 3588 |
3589 void EndToEndTest::VerifyNewVideoSendStreamsRespectNetworkState( | 3589 void EndToEndTest::VerifyNewVideoSendStreamsRespectNetworkState( |
3590 MediaType network_to_bring_up, | 3590 MediaType network_to_bring_down, |
3591 VideoEncoder* encoder, | 3591 VideoEncoder* encoder, |
3592 Transport* transport) { | 3592 Transport* transport) { |
3593 CreateSenderCall(Call::Config(&event_log_)); | 3593 CreateSenderCall(Call::Config(&event_log_)); |
3594 sender_call_->SignalChannelNetworkState(network_to_bring_up, kNetworkUp); | 3594 sender_call_->SignalChannelNetworkState(network_to_bring_down, kNetworkDown); |
3595 | 3595 |
3596 CreateSendConfig(1, 0, 0, transport); | 3596 CreateSendConfig(1, 0, 0, transport); |
3597 video_send_config_.encoder_settings.encoder = encoder; | 3597 video_send_config_.encoder_settings.encoder = encoder; |
3598 CreateVideoStreams(); | 3598 CreateVideoStreams(); |
3599 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, | 3599 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, |
3600 kDefaultHeight); | 3600 kDefaultHeight); |
3601 | 3601 |
3602 Start(); | 3602 Start(); |
3603 SleepMs(kSilenceTimeoutMs); | 3603 SleepMs(kSilenceTimeoutMs); |
3604 Stop(); | 3604 Stop(); |
3605 | 3605 |
3606 DestroyStreams(); | 3606 DestroyStreams(); |
3607 } | 3607 } |
3608 | 3608 |
3609 void EndToEndTest::VerifyNewVideoReceiveStreamsRespectNetworkState( | 3609 void EndToEndTest::VerifyNewVideoReceiveStreamsRespectNetworkState( |
3610 MediaType network_to_bring_up, | 3610 MediaType network_to_bring_down, |
3611 Transport* transport) { | 3611 Transport* transport) { |
3612 Call::Config config(&event_log_); | 3612 Call::Config config(&event_log_); |
3613 CreateCalls(config, config); | 3613 CreateCalls(config, config); |
3614 receiver_call_->SignalChannelNetworkState(network_to_bring_up, kNetworkUp); | 3614 receiver_call_->SignalChannelNetworkState(network_to_bring_down, |
| 3615 kNetworkDown); |
3615 | 3616 |
3616 test::DirectTransport sender_transport(sender_call_.get()); | 3617 test::DirectTransport sender_transport(sender_call_.get()); |
3617 sender_transport.SetReceiver(receiver_call_->Receiver()); | 3618 sender_transport.SetReceiver(receiver_call_->Receiver()); |
3618 CreateSendConfig(1, 0, 0, &sender_transport); | 3619 CreateSendConfig(1, 0, 0, &sender_transport); |
3619 CreateMatchingReceiveConfigs(transport); | 3620 CreateMatchingReceiveConfigs(transport); |
3620 CreateVideoStreams(); | 3621 CreateVideoStreams(); |
3621 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, | 3622 CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth, |
3622 kDefaultHeight); | 3623 kDefaultHeight); |
3623 | 3624 |
3624 Start(); | 3625 Start(); |
(...skipping 21 matching lines...) Expand all Loading... |
3646 const std::vector<FrameType>* frame_types) override { | 3647 const std::vector<FrameType>* frame_types) override { |
3647 ADD_FAILURE() << "Unexpected frame encode."; | 3648 ADD_FAILURE() << "Unexpected frame encode."; |
3648 return test::FakeEncoder::Encode(input_image, codec_specific_info, | 3649 return test::FakeEncoder::Encode(input_image, codec_specific_info, |
3649 frame_types); | 3650 frame_types); |
3650 } | 3651 } |
3651 }; | 3652 }; |
3652 | 3653 |
3653 UnusedEncoder unused_encoder; | 3654 UnusedEncoder unused_encoder; |
3654 UnusedTransport unused_transport; | 3655 UnusedTransport unused_transport; |
3655 VerifyNewVideoSendStreamsRespectNetworkState( | 3656 VerifyNewVideoSendStreamsRespectNetworkState( |
3656 MediaType::AUDIO, &unused_encoder, &unused_transport); | 3657 MediaType::VIDEO, &unused_encoder, &unused_transport); |
3657 } | 3658 } |
3658 | 3659 |
3659 TEST_F(EndToEndTest, NewVideoSendStreamsIgnoreAudioNetworkDown) { | 3660 TEST_F(EndToEndTest, NewVideoSendStreamsIgnoreAudioNetworkDown) { |
3660 class RequiredEncoder : public test::FakeEncoder { | 3661 class RequiredEncoder : public test::FakeEncoder { |
3661 public: | 3662 public: |
3662 RequiredEncoder() | 3663 RequiredEncoder() |
3663 : FakeEncoder(Clock::GetRealTimeClock()), encoded_frame_(false) {} | 3664 : FakeEncoder(Clock::GetRealTimeClock()), encoded_frame_(false) {} |
3664 ~RequiredEncoder() { | 3665 ~RequiredEncoder() { |
3665 if (!encoded_frame_) { | 3666 if (!encoded_frame_) { |
3666 ADD_FAILURE() << "Didn't encode an expected frame"; | 3667 ADD_FAILURE() << "Didn't encode an expected frame"; |
3667 } | 3668 } |
3668 } | 3669 } |
3669 int32_t Encode(const VideoFrame& input_image, | 3670 int32_t Encode(const VideoFrame& input_image, |
3670 const CodecSpecificInfo* codec_specific_info, | 3671 const CodecSpecificInfo* codec_specific_info, |
3671 const std::vector<FrameType>* frame_types) override { | 3672 const std::vector<FrameType>* frame_types) override { |
3672 encoded_frame_ = true; | 3673 encoded_frame_ = true; |
3673 return test::FakeEncoder::Encode(input_image, codec_specific_info, | 3674 return test::FakeEncoder::Encode(input_image, codec_specific_info, |
3674 frame_types); | 3675 frame_types); |
3675 } | 3676 } |
3676 | 3677 |
3677 private: | 3678 private: |
3678 bool encoded_frame_; | 3679 bool encoded_frame_; |
3679 }; | 3680 }; |
3680 | 3681 |
3681 RequiredTransport required_transport(true /*rtp*/, false /*rtcp*/); | 3682 RequiredTransport required_transport(true /*rtp*/, false /*rtcp*/); |
3682 RequiredEncoder required_encoder; | 3683 RequiredEncoder required_encoder; |
3683 VerifyNewVideoSendStreamsRespectNetworkState( | 3684 VerifyNewVideoSendStreamsRespectNetworkState( |
3684 MediaType::VIDEO, &required_encoder, &required_transport); | 3685 MediaType::AUDIO, &required_encoder, &required_transport); |
3685 } | 3686 } |
3686 | 3687 |
3687 TEST_F(EndToEndTest, NewVideoReceiveStreamsRespectVideoNetworkDown) { | 3688 TEST_F(EndToEndTest, NewVideoReceiveStreamsRespectVideoNetworkDown) { |
3688 UnusedTransport transport; | 3689 UnusedTransport transport; |
3689 VerifyNewVideoReceiveStreamsRespectNetworkState(MediaType::AUDIO, &transport); | 3690 VerifyNewVideoReceiveStreamsRespectNetworkState(MediaType::VIDEO, &transport); |
3690 } | 3691 } |
3691 | 3692 |
3692 TEST_F(EndToEndTest, NewVideoReceiveStreamsIgnoreAudioNetworkDown) { | 3693 TEST_F(EndToEndTest, NewVideoReceiveStreamsIgnoreAudioNetworkDown) { |
3693 RequiredTransport transport(false /*rtp*/, true /*rtcp*/); | 3694 RequiredTransport transport(false /*rtp*/, true /*rtcp*/); |
3694 VerifyNewVideoReceiveStreamsRespectNetworkState(MediaType::VIDEO, &transport); | 3695 VerifyNewVideoReceiveStreamsRespectNetworkState(MediaType::AUDIO, &transport); |
3695 } | 3696 } |
3696 | 3697 |
3697 void VerifyEmptyNackConfig(const NackConfig& config) { | 3698 void VerifyEmptyNackConfig(const NackConfig& config) { |
3698 EXPECT_EQ(0, config.rtp_history_ms) | 3699 EXPECT_EQ(0, config.rtp_history_ms) |
3699 << "Enabling NACK requires rtcp-fb: nack negotiation."; | 3700 << "Enabling NACK requires rtcp-fb: nack negotiation."; |
3700 } | 3701 } |
3701 | 3702 |
3702 void VerifyEmptyUlpfecConfig(const UlpfecConfig& config) { | 3703 void VerifyEmptyUlpfecConfig(const UlpfecConfig& config) { |
3703 EXPECT_EQ(-1, config.ulpfec_payload_type) | 3704 EXPECT_EQ(-1, config.ulpfec_payload_type) |
3704 << "Enabling ULPFEC requires rtpmap: ulpfec negotiation."; | 3705 << "Enabling ULPFEC requires rtpmap: ulpfec negotiation."; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3906 std::unique_ptr<VideoEncoder> encoder_; | 3907 std::unique_ptr<VideoEncoder> encoder_; |
3907 std::unique_ptr<VideoDecoder> decoder_; | 3908 std::unique_ptr<VideoDecoder> decoder_; |
3908 rtc::CriticalSection crit_; | 3909 rtc::CriticalSection crit_; |
3909 int recorded_frames_ GUARDED_BY(crit_); | 3910 int recorded_frames_ GUARDED_BY(crit_); |
3910 } test(this); | 3911 } test(this); |
3911 | 3912 |
3912 RunBaseTest(&test); | 3913 RunBaseTest(&test); |
3913 } | 3914 } |
3914 | 3915 |
3915 } // namespace webrtc | 3916 } // namespace webrtc |
OLD | NEW |