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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 | 812 |
813 // Test that external codecs are added to the end of the supported codec list. | 813 // Test that external codecs are added to the end of the supported codec list. |
814 TEST_F(WebRtcVideoEngineTest, ReportSupportedExternalCodecs) { | 814 TEST_F(WebRtcVideoEngineTest, ReportSupportedExternalCodecs) { |
815 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 815 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
816 encoder_factory.AddSupportedVideoCodecType("FakeExternalCodec"); | 816 encoder_factory.AddSupportedVideoCodecType("FakeExternalCodec"); |
817 engine_.SetExternalEncoderFactory(&encoder_factory); | 817 engine_.SetExternalEncoderFactory(&encoder_factory); |
818 engine_.Init(); | 818 engine_.Init(); |
819 | 819 |
820 std::vector<cricket::VideoCodec> codecs(engine_.codecs()); | 820 std::vector<cricket::VideoCodec> codecs(engine_.codecs()); |
821 ASSERT_GE(codecs.size(), 2u); | 821 ASSERT_GE(codecs.size(), 2u); |
822 cricket::VideoCodec internal_codec = codecs.front(); | 822 cricket::VideoCodec external_codec = codecs[0]; |
823 cricket::VideoCodec external_codec = codecs.back(); | 823 cricket::VideoCodec internal_codec = codecs[1]; |
824 | 824 |
825 // The external codec will appear last in the vector. | 825 // The external codec will appear first in the vector. |
| 826 EXPECT_EQ("FakeExternalCodec", external_codec.name); |
826 EXPECT_EQ("VP8", internal_codec.name); | 827 EXPECT_EQ("VP8", internal_codec.name); |
827 EXPECT_EQ("FakeExternalCodec", external_codec.name); | |
828 } | 828 } |
829 | 829 |
830 // Test that an external codec that was added after the engine was initialized | 830 // Test that an external codec that was added after the engine was initialized |
831 // does show up in the codec list after it was added. | 831 // does show up in the codec list after it was added. |
832 TEST_F(WebRtcVideoEngineTest, ReportSupportedExternalCodecsWithAddedCodec) { | 832 TEST_F(WebRtcVideoEngineTest, ReportSupportedExternalCodecsWithAddedCodec) { |
833 // Set up external encoder factory with first codec, and initialize engine. | 833 // Set up external encoder factory with first codec, and initialize engine. |
834 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 834 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
835 encoder_factory.AddSupportedVideoCodecType("FakeExternalCodec1"); | 835 encoder_factory.AddSupportedVideoCodecType("FakeExternalCodec1"); |
836 engine_.SetExternalEncoderFactory(&encoder_factory); | 836 engine_.SetExternalEncoderFactory(&encoder_factory); |
837 engine_.Init(); | 837 engine_.Init(); |
838 | 838 |
839 // The first external codec will appear last in the vector. | 839 // The first external codec will appear first in the vector. |
840 std::vector<cricket::VideoCodec> codecs_before(engine_.codecs()); | 840 std::vector<cricket::VideoCodec> codecs_before(engine_.codecs()); |
841 EXPECT_EQ("FakeExternalCodec1", codecs_before.back().name); | 841 EXPECT_EQ("FakeExternalCodec1", codecs_before.front().name); |
842 | 842 |
843 // Add second codec. | 843 // Add second codec. |
844 encoder_factory.AddSupportedVideoCodecType("FakeExternalCodec2"); | 844 encoder_factory.AddSupportedVideoCodecType("FakeExternalCodec2"); |
845 std::vector<cricket::VideoCodec> codecs_after(engine_.codecs()); | 845 std::vector<cricket::VideoCodec> codecs_after(engine_.codecs()); |
846 EXPECT_EQ(codecs_before.size() + 1, codecs_after.size()); | 846 EXPECT_EQ(codecs_before.size() + 1, codecs_after.size()); |
847 EXPECT_EQ("FakeExternalCodec2", codecs_after.back().name); | 847 EXPECT_EQ("FakeExternalCodec2", codecs_after[1].name); |
848 } | 848 } |
849 | 849 |
850 TEST_F(WebRtcVideoEngineTest, RegisterExternalDecodersIfSupported) { | 850 TEST_F(WebRtcVideoEngineTest, RegisterExternalDecodersIfSupported) { |
851 cricket::FakeWebRtcVideoDecoderFactory decoder_factory; | 851 cricket::FakeWebRtcVideoDecoderFactory decoder_factory; |
852 decoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8); | 852 decoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8); |
853 cricket::VideoRecvParameters parameters; | 853 cricket::VideoRecvParameters parameters; |
854 parameters.codecs.push_back(GetEngineCodec("VP8")); | 854 parameters.codecs.push_back(GetEngineCodec("VP8")); |
855 | 855 |
856 std::unique_ptr<VideoMediaChannel> channel( | 856 std::unique_ptr<VideoMediaChannel> channel( |
857 SetUpForExternalDecoderFactory(&decoder_factory, parameters.codecs)); | 857 SetUpForExternalDecoderFactory(&decoder_factory, parameters.codecs)); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 engine_.Init(); | 1059 engine_.Init(); |
1060 channel_.reset(engine_.CreateChannel(fake_call_.get(), GetMediaConfig(), | 1060 channel_.reset(engine_.CreateChannel(fake_call_.get(), GetMediaConfig(), |
1061 VideoOptions())); | 1061 VideoOptions())); |
1062 channel_->OnReadyToSend(true); | 1062 channel_->OnReadyToSend(true); |
1063 last_ssrc_ = 123; | 1063 last_ssrc_ = 123; |
1064 send_parameters_.codecs = engine_.codecs(); | 1064 send_parameters_.codecs = engine_.codecs(); |
1065 recv_parameters_.codecs = engine_.codecs(); | 1065 recv_parameters_.codecs = engine_.codecs(); |
1066 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); | 1066 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); |
1067 } | 1067 } |
1068 | 1068 |
| 1069 void TearDown() override { |
| 1070 channel_ = nullptr; |
| 1071 fake_call_ = nullptr; |
| 1072 } |
| 1073 |
1069 protected: | 1074 protected: |
1070 FakeVideoSendStream* AddSendStream() { | 1075 FakeVideoSendStream* AddSendStream() { |
1071 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); | 1076 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); |
1072 } | 1077 } |
1073 | 1078 |
1074 FakeVideoSendStream* AddSendStream(const StreamParams& sp) { | 1079 FakeVideoSendStream* AddSendStream(const StreamParams& sp) { |
1075 size_t num_streams = fake_call_->GetVideoSendStreams().size(); | 1080 size_t num_streams = fake_call_->GetVideoSendStreams().size(); |
1076 EXPECT_TRUE(channel_->AddSendStream(sp)); | 1081 EXPECT_TRUE(channel_->AddSendStream(sp)); |
1077 std::vector<FakeVideoSendStream*> streams = | 1082 std::vector<FakeVideoSendStream*> streams = |
1078 fake_call_->GetVideoSendStreams(); | 1083 fake_call_->GetVideoSendStreams(); |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 void SetUp() override { | 1973 void SetUp() override { |
1969 engine_.SetExternalEncoderFactory(&encoder_factory_); | 1974 engine_.SetExternalEncoderFactory(&encoder_factory_); |
1970 | 1975 |
1971 WebRtcVideoChannelTest::SetUp(); | 1976 WebRtcVideoChannelTest::SetUp(); |
1972 } | 1977 } |
1973 | 1978 |
1974 void TearDown() override { | 1979 void TearDown() override { |
1975 // Remove references to encoder_factory_ since this will be destroyed | 1980 // Remove references to encoder_factory_ since this will be destroyed |
1976 // before channel_ and engine_. | 1981 // before channel_ and engine_. |
1977 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); | 1982 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 1983 |
| 1984 WebRtcVideoChannelTest::TearDown(); |
1978 } | 1985 } |
1979 | 1986 |
1980 cricket::FakeWebRtcVideoEncoderFactory encoder_factory_; | 1987 cricket::FakeWebRtcVideoEncoderFactory encoder_factory_; |
1981 }; | 1988 }; |
1982 | 1989 |
1983 TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) { | 1990 TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) { |
1984 cricket::VideoSendParameters parameters; | 1991 cricket::VideoSendParameters parameters; |
1985 parameters.codecs.push_back(GetEngineCodec("VP9")); | 1992 parameters.codecs.push_back(GetEngineCodec("VP9")); |
1986 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 1993 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
1987 | 1994 |
(...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4681 | 4688 |
4682 TEST_F(WebRtcVideoChannelSimulcastTest, | 4689 TEST_F(WebRtcVideoChannelSimulcastTest, |
4683 NoSimulcastScreenshareWithoutConference) { | 4690 NoSimulcastScreenshareWithoutConference) { |
4684 webrtc::test::ScopedFieldTrials override_field_trials_( | 4691 webrtc::test::ScopedFieldTrials override_field_trials_( |
4685 "WebRTC-SimulcastScreenshare/Enabled/"); | 4692 "WebRTC-SimulcastScreenshare/Enabled/"); |
4686 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 1, true, | 4693 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 1, true, |
4687 false); | 4694 false); |
4688 } | 4695 } |
4689 | 4696 |
4690 } // namespace cricket | 4697 } // namespace cricket |
OLD | NEW |