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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 } | 815 } |
816 | 816 |
817 class WebRtcVideoChannel2BaseTest | 817 class WebRtcVideoChannel2BaseTest |
818 : public VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> { | 818 : public VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> { |
819 protected: | 819 protected: |
820 typedef VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> Base; | 820 typedef VideoMediaChannelTest<WebRtcVideoEngine2, WebRtcVideoChannel2> Base; |
821 | 821 |
822 cricket::VideoCodec DefaultCodec() override { return kVp8Codec; } | 822 cricket::VideoCodec DefaultCodec() override { return kVp8Codec; } |
823 }; | 823 }; |
824 | 824 |
825 // Verifies that id given in stream params is passed to the decoder factory, | |
826 TEST_F(WebRtcVideoEngine2Test, StreamParamsIdPassedToDecoderFactory) { | |
827 cricket::FakeWebRtcVideoDecoderFactory decoder_factory; | |
828 decoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8); | |
829 cricket::VideoRecvParameters parameters; | |
830 parameters.codecs.push_back(kVp8Codec); | |
831 | |
832 std::unique_ptr<VideoMediaChannel> channel( | |
833 SetUpForExternalDecoderFactory(&decoder_factory, parameters.codecs)); | |
834 | |
835 StreamParams sp = cricket::StreamParams::CreateLegacy(kSsrc); | |
836 sp.id = "FakeStreamParamsId"; | |
837 EXPECT_TRUE(channel->AddRecvStream(sp)); | |
838 EXPECT_EQ(1u, decoder_factory.decoders().size()); | |
839 | |
840 std::vector<cricket::VideoDecoderParams> params = decoder_factory.params(); | |
841 ASSERT_EQ(1u, params.size()); | |
842 EXPECT_EQ("FakeStreamParamsId", params[0].receive_stream_id); | |
pthatcher1
2016/06/22 05:59:01
EXPECT_EQ(sp.id, params[0].receive_stream_id);
wo
| |
843 } | |
844 | |
825 #define WEBRTC_BASE_TEST(test) \ | 845 #define WEBRTC_BASE_TEST(test) \ |
826 TEST_F(WebRtcVideoChannel2BaseTest, test) { Base::test(); } | 846 TEST_F(WebRtcVideoChannel2BaseTest, test) { Base::test(); } |
827 | 847 |
828 #define WEBRTC_DISABLED_BASE_TEST(test) \ | 848 #define WEBRTC_DISABLED_BASE_TEST(test) \ |
829 TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_##test) { Base::test(); } | 849 TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_##test) { Base::test(); } |
830 | 850 |
831 WEBRTC_BASE_TEST(SetSend); | 851 WEBRTC_BASE_TEST(SetSend); |
832 WEBRTC_BASE_TEST(SetSendWithoutCodecs); | 852 WEBRTC_BASE_TEST(SetSendWithoutCodecs); |
833 WEBRTC_BASE_TEST(SetSendSetsTransportBufferSizes); | 853 WEBRTC_BASE_TEST(SetSendSetsTransportBufferSizes); |
834 | 854 |
(...skipping 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3540 parameters.codecs.push_back(kVp9Codec); | 3560 parameters.codecs.push_back(kVp9Codec); |
3541 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 3561 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
3542 | 3562 |
3543 webrtc::RtpParameters rtp_parameters = | 3563 webrtc::RtpParameters rtp_parameters = |
3544 channel_->GetRtpReceiveParameters(last_ssrc_); | 3564 channel_->GetRtpReceiveParameters(last_ssrc_); |
3545 ASSERT_EQ(2u, rtp_parameters.codecs.size()); | 3565 ASSERT_EQ(2u, rtp_parameters.codecs.size()); |
3546 EXPECT_EQ(kVp8Codec.ToCodecParameters(), rtp_parameters.codecs[0]); | 3566 EXPECT_EQ(kVp8Codec.ToCodecParameters(), rtp_parameters.codecs[0]); |
3547 EXPECT_EQ(kVp9Codec.ToCodecParameters(), rtp_parameters.codecs[1]); | 3567 EXPECT_EQ(kVp9Codec.ToCodecParameters(), rtp_parameters.codecs[1]); |
3548 } | 3568 } |
3549 | 3569 |
3570 // Test that RtpParameters for receive stream has one encoding and it has | |
3571 // the correct SSRC. | |
3572 TEST_F(WebRtcVideoChannel2Test, RtpEncodingParametersSsrcIsSet) { | |
3573 AddRecvStream(); | |
3574 | |
3575 webrtc::RtpParameters rtp_parameters = | |
3576 channel_->GetRtpReceiveParameters(last_ssrc_); | |
3577 ASSERT_EQ(1u, rtp_parameters.encodings.size()); | |
3578 EXPECT_EQ(rtc::Optional<uint32_t>(last_ssrc_), | |
3579 rtp_parameters.encodings[0].ssrc); | |
3580 } | |
3581 | |
3550 // Test that if we set/get parameters multiple times, we get the same results. | 3582 // Test that if we set/get parameters multiple times, we get the same results. |
3551 TEST_F(WebRtcVideoChannel2Test, SetAndGetRtpReceiveParameters) { | 3583 TEST_F(WebRtcVideoChannel2Test, SetAndGetRtpReceiveParameters) { |
3552 AddRecvStream(); | 3584 AddRecvStream(); |
3553 cricket::VideoRecvParameters parameters; | 3585 cricket::VideoRecvParameters parameters; |
3554 parameters.codecs.push_back(kVp8Codec); | 3586 parameters.codecs.push_back(kVp8Codec); |
3555 parameters.codecs.push_back(kVp9Codec); | 3587 parameters.codecs.push_back(kVp9Codec); |
3556 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); | 3588 EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
3557 | 3589 |
3558 webrtc::RtpParameters initial_params = | 3590 webrtc::RtpParameters initial_params = |
3559 channel_->GetRtpReceiveParameters(last_ssrc_); | 3591 channel_->GetRtpReceiveParameters(last_ssrc_); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3754 } | 3786 } |
3755 | 3787 |
3756 // Test that we normalize send codec format size in simulcast. | 3788 // Test that we normalize send codec format size in simulcast. |
3757 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3789 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3758 cricket::VideoCodec codec(kVp8Codec270p); | 3790 cricket::VideoCodec codec(kVp8Codec270p); |
3759 codec.width += 1; | 3791 codec.width += 1; |
3760 codec.height += 1; | 3792 codec.height += 1; |
3761 VerifySimulcastSettings(codec, 2, 2); | 3793 VerifySimulcastSettings(codec, 2, 2); |
3762 } | 3794 } |
3763 } // namespace cricket | 3795 } // namespace cricket |
OLD | NEW |