| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 | 10 |
| (...skipping 3643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3654 } | 3654 } |
| 3655 | 3655 |
| 3656 TEST_F(WebRtcVideoChannel2Test, | 3656 TEST_F(WebRtcVideoChannel2Test, |
| 3657 CannotSetRtpSendParametersWithIncorrectNumberOfEncodings) { | 3657 CannotSetRtpSendParametersWithIncorrectNumberOfEncodings) { |
| 3658 // This test verifies that setting RtpParameters succeeds only if | 3658 // This test verifies that setting RtpParameters succeeds only if |
| 3659 // the structure contains exactly one encoding. | 3659 // the structure contains exactly one encoding. |
| 3660 // TODO(skvlad): Update this test when we start supporting setting parameters | 3660 // TODO(skvlad): Update this test when we start supporting setting parameters |
| 3661 // for each encoding individually. | 3661 // for each encoding individually. |
| 3662 | 3662 |
| 3663 AddSendStream(); | 3663 AddSendStream(); |
| 3664 // Setting RtpParameters with no encoding is expected to fail. | |
| 3665 webrtc::RtpParameters parameters = channel_->GetRtpSendParameters(last_ssrc_); | 3664 webrtc::RtpParameters parameters = channel_->GetRtpSendParameters(last_ssrc_); |
| 3665 // Two or more encodings should result in failure. |
| 3666 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); |
| 3667 EXPECT_FALSE(channel_->SetRtpSendParameters(last_ssrc_, parameters)); |
| 3668 // Zero encodings should also fail. |
| 3666 parameters.encodings.clear(); | 3669 parameters.encodings.clear(); |
| 3667 EXPECT_FALSE(channel_->SetRtpSendParameters(last_ssrc_, parameters)); | 3670 EXPECT_FALSE(channel_->SetRtpSendParameters(last_ssrc_, parameters)); |
| 3668 // Setting RtpParameters with exactly one encoding should succeed. | 3671 } |
| 3669 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); | 3672 |
| 3670 EXPECT_TRUE(channel_->SetRtpSendParameters(last_ssrc_, parameters)); | 3673 // Changing the SSRC through RtpParameters is not allowed. |
| 3671 // Two or more encodings should result in failure. | 3674 TEST_F(WebRtcVideoChannel2Test, CannotSetSsrcInRtpSendParameters) { |
| 3672 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); | 3675 AddSendStream(); |
| 3676 webrtc::RtpParameters parameters = channel_->GetRtpSendParameters(last_ssrc_); |
| 3677 parameters.encodings[0].ssrc = rtc::Optional<uint32_t>(0xdeadbeef); |
| 3673 EXPECT_FALSE(channel_->SetRtpSendParameters(last_ssrc_, parameters)); | 3678 EXPECT_FALSE(channel_->SetRtpSendParameters(last_ssrc_, parameters)); |
| 3674 } | 3679 } |
| 3675 | 3680 |
| 3676 // Test that a stream will not be sending if its encoding is made inactive | 3681 // Test that a stream will not be sending if its encoding is made inactive |
| 3677 // through SetRtpSendParameters. | 3682 // through SetRtpSendParameters. |
| 3678 // TODO(deadbeef): Update this test when we start supporting setting parameters | 3683 // TODO(deadbeef): Update this test when we start supporting setting parameters |
| 3679 // for each encoding individually. | 3684 // for each encoding individually. |
| 3680 TEST_F(WebRtcVideoChannel2Test, SetRtpSendParametersEncodingsActive) { | 3685 TEST_F(WebRtcVideoChannel2Test, SetRtpSendParametersEncodingsActive) { |
| 3681 FakeVideoSendStream* stream = AddSendStream(); | 3686 FakeVideoSendStream* stream = AddSendStream(); |
| 3682 EXPECT_TRUE(channel_->SetSend(true)); | 3687 EXPECT_TRUE(channel_->SetSend(true)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3746 | 3751 |
| 3747 webrtc::RtpParameters rtp_parameters = | 3752 webrtc::RtpParameters rtp_parameters = |
| 3748 channel_->GetRtpSendParameters(last_ssrc_); | 3753 channel_->GetRtpSendParameters(last_ssrc_); |
| 3749 ASSERT_EQ(2u, rtp_parameters.codecs.size()); | 3754 ASSERT_EQ(2u, rtp_parameters.codecs.size()); |
| 3750 EXPECT_EQ(GetEngineCodec("VP8").ToCodecParameters(), | 3755 EXPECT_EQ(GetEngineCodec("VP8").ToCodecParameters(), |
| 3751 rtp_parameters.codecs[0]); | 3756 rtp_parameters.codecs[0]); |
| 3752 EXPECT_EQ(GetEngineCodec("VP9").ToCodecParameters(), | 3757 EXPECT_EQ(GetEngineCodec("VP9").ToCodecParameters(), |
| 3753 rtp_parameters.codecs[1]); | 3758 rtp_parameters.codecs[1]); |
| 3754 } | 3759 } |
| 3755 | 3760 |
| 3761 // Test that RtpParameters for send stream has one encoding and it has |
| 3762 // the correct SSRC. |
| 3763 TEST_F(WebRtcVideoChannel2Test, GetRtpSendParametersSsrc) { |
| 3764 AddSendStream(); |
| 3765 |
| 3766 webrtc::RtpParameters rtp_parameters = |
| 3767 channel_->GetRtpSendParameters(last_ssrc_); |
| 3768 ASSERT_EQ(1u, rtp_parameters.encodings.size()); |
| 3769 EXPECT_EQ(rtc::Optional<uint32_t>(last_ssrc_), |
| 3770 rtp_parameters.encodings[0].ssrc); |
| 3771 } |
| 3772 |
| 3756 // Test that if we set/get parameters multiple times, we get the same results. | 3773 // Test that if we set/get parameters multiple times, we get the same results. |
| 3757 TEST_F(WebRtcVideoChannel2Test, SetAndGetRtpSendParameters) { | 3774 TEST_F(WebRtcVideoChannel2Test, SetAndGetRtpSendParameters) { |
| 3758 AddSendStream(); | 3775 AddSendStream(); |
| 3759 cricket::VideoSendParameters parameters; | 3776 cricket::VideoSendParameters parameters; |
| 3760 parameters.codecs.push_back(GetEngineCodec("VP8")); | 3777 parameters.codecs.push_back(GetEngineCodec("VP8")); |
| 3761 parameters.codecs.push_back(GetEngineCodec("VP9")); | 3778 parameters.codecs.push_back(GetEngineCodec("VP9")); |
| 3762 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 3779 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
| 3763 | 3780 |
| 3764 webrtc::RtpParameters initial_params = | 3781 webrtc::RtpParameters initial_params = |
| 3765 channel_->GetRtpSendParameters(last_ssrc_); | 3782 channel_->GetRtpSendParameters(last_ssrc_); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3819 EXPECT_EQ(102, cfg.decoders[1].payload_type); | 3836 EXPECT_EQ(102, cfg.decoders[1].payload_type); |
| 3820 EXPECT_EQ("H264", cfg.decoders[1].payload_name); | 3837 EXPECT_EQ("H264", cfg.decoders[1].payload_name); |
| 3821 const auto it1 = | 3838 const auto it1 = |
| 3822 cfg.decoders[1].codec_params.find(kH264FmtpSpropParameterSets); | 3839 cfg.decoders[1].codec_params.find(kH264FmtpSpropParameterSets); |
| 3823 ASSERT_TRUE(it1 != cfg.decoders[1].codec_params.end()); | 3840 ASSERT_TRUE(it1 != cfg.decoders[1].codec_params.end()); |
| 3824 EXPECT_EQ("xyz", it1->second); | 3841 EXPECT_EQ("xyz", it1->second); |
| 3825 } | 3842 } |
| 3826 | 3843 |
| 3827 // Test that RtpParameters for receive stream has one encoding and it has | 3844 // Test that RtpParameters for receive stream has one encoding and it has |
| 3828 // the correct SSRC. | 3845 // the correct SSRC. |
| 3829 TEST_F(WebRtcVideoChannel2Test, RtpEncodingParametersSsrcIsSet) { | 3846 TEST_F(WebRtcVideoChannel2Test, GetRtpReceiveParametersSsrc) { |
| 3830 AddRecvStream(); | 3847 AddRecvStream(); |
| 3831 | 3848 |
| 3832 webrtc::RtpParameters rtp_parameters = | 3849 webrtc::RtpParameters rtp_parameters = |
| 3833 channel_->GetRtpReceiveParameters(last_ssrc_); | 3850 channel_->GetRtpReceiveParameters(last_ssrc_); |
| 3834 ASSERT_EQ(1u, rtp_parameters.encodings.size()); | 3851 ASSERT_EQ(1u, rtp_parameters.encodings.size()); |
| 3835 EXPECT_EQ(rtc::Optional<uint32_t>(last_ssrc_), | 3852 EXPECT_EQ(rtc::Optional<uint32_t>(last_ssrc_), |
| 3836 rtp_parameters.encodings[0].ssrc); | 3853 rtp_parameters.encodings[0].ssrc); |
| 3837 } | 3854 } |
| 3838 | 3855 |
| 3839 // Test that if we set/get parameters multiple times, we get the same results. | 3856 // Test that if we set/get parameters multiple times, we get the same results. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4041 | 4058 |
| 4042 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { | 4059 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { |
| 4043 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); | 4060 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); |
| 4044 } | 4061 } |
| 4045 | 4062 |
| 4046 // Test that we normalize send codec format size in simulcast. | 4063 // Test that we normalize send codec format size in simulcast. |
| 4047 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 4064 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
| 4048 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); | 4065 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); |
| 4049 } | 4066 } |
| 4050 } // namespace cricket | 4067 } // namespace cricket |
| OLD | NEW |