OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Used in WebRtcVideoEngine2VoiceTest, but defined here so it's properly | 161 // Used in WebRtcVideoEngine2VoiceTest, but defined here so it's properly |
162 // initialized when the constructor is called. | 162 // initialized when the constructor is called. |
163 WebRtcVoiceEngine voice_engine_; | 163 WebRtcVoiceEngine voice_engine_; |
164 WebRtcVideoEngine2 engine_; | 164 WebRtcVideoEngine2 engine_; |
165 VideoCodec default_codec_; | 165 VideoCodec default_codec_; |
166 VideoCodec default_red_codec_; | 166 VideoCodec default_red_codec_; |
167 VideoCodec default_ulpfec_codec_; | 167 VideoCodec default_ulpfec_codec_; |
168 std::map<int, int> default_apt_rtx_types_; | 168 std::map<int, int> default_apt_rtx_types_; |
169 }; | 169 }; |
170 | 170 |
171 class WebRtcVideoEngine2VoiceTest : public WebRtcVideoEngine2Test { | |
172 public: | |
173 WebRtcVideoEngine2VoiceTest() : WebRtcVideoEngine2Test(&voice_engine_) {} | |
174 }; | |
175 | |
176 TEST_F(WebRtcVideoEngine2VoiceTest, ConfiguresAvSyncForFirstReceiveChannel) { | |
177 FakeCallFactory call_factory; | |
178 engine_.SetCallFactory(&call_factory); | |
179 voice_engine_.Init(rtc::Thread::Current()); | |
180 engine_.Init(); | |
181 | |
182 rtc::scoped_ptr<VoiceMediaChannel> voice_channel( | |
183 voice_engine_.CreateChannel(cricket::AudioOptions())); | |
184 ASSERT_TRUE(voice_channel.get() != nullptr); | |
185 WebRtcVoiceMediaChannel* webrtc_voice_channel = | |
186 static_cast<WebRtcVoiceMediaChannel*>(voice_channel.get()); | |
187 ASSERT_NE(webrtc_voice_channel->voe_channel(), -1); | |
188 rtc::scoped_ptr<VideoMediaChannel> channel( | |
189 engine_.CreateChannel(cricket::VideoOptions(), voice_channel.get())); | |
190 | |
191 FakeCall* fake_call = call_factory.GetCall(); | |
192 ASSERT_TRUE(fake_call != nullptr); | |
193 | |
194 webrtc::Call::Config call_config = fake_call->GetConfig(); | |
195 | |
196 ASSERT_TRUE(voice_engine_.voe()->engine() != nullptr); | |
197 ASSERT_EQ(voice_engine_.voe()->engine(), call_config.voice_engine); | |
198 | |
199 EXPECT_TRUE(channel->AddRecvStream(StreamParams::CreateLegacy(kSsrc))); | |
200 EXPECT_TRUE(channel->AddRecvStream(StreamParams::CreateLegacy(kSsrc + 1))); | |
201 std::vector<FakeVideoReceiveStream*> receive_streams = | |
202 fake_call->GetVideoReceiveStreams(); | |
203 | |
204 ASSERT_EQ(2u, receive_streams.size()); | |
205 EXPECT_EQ(webrtc_voice_channel->voe_channel(), | |
206 receive_streams[0]->GetConfig().audio_channel_id); | |
207 EXPECT_EQ(-1, receive_streams[1]->GetConfig().audio_channel_id) | |
208 << "AV sync should only be set up for the first receive channel."; | |
209 } | |
210 | |
211 TEST_F(WebRtcVideoEngine2Test, FindCodec) { | 171 TEST_F(WebRtcVideoEngine2Test, FindCodec) { |
212 const std::vector<cricket::VideoCodec>& c = engine_.codecs(); | 172 const std::vector<cricket::VideoCodec>& c = engine_.codecs(); |
213 EXPECT_EQ(cricket::DefaultVideoCodecList().size(), c.size()); | 173 EXPECT_EQ(cricket::DefaultVideoCodecList().size(), c.size()); |
214 | 174 |
215 cricket::VideoCodec vp8(104, "VP8", 320, 200, 30, 0); | 175 cricket::VideoCodec vp8(104, "VP8", 320, 200, 30, 0); |
216 EXPECT_TRUE(engine_.FindCodec(vp8)); | 176 EXPECT_TRUE(engine_.FindCodec(vp8)); |
217 | 177 |
218 cricket::VideoCodec vp8_ci(104, "vp8", 320, 200, 30, 0); | 178 cricket::VideoCodec vp8_ci(104, "vp8", 320, 200, 30, 0); |
219 EXPECT_TRUE(engine_.FindCodec(vp8)); | 179 EXPECT_TRUE(engine_.FindCodec(vp8)); |
220 | 180 |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 } else { | 956 } else { |
997 return AddSendStream(StreamParams::CreateLegacy(last_ssrc_)); | 957 return AddSendStream(StreamParams::CreateLegacy(last_ssrc_)); |
998 } | 958 } |
999 } | 959 } |
1000 | 960 |
1001 FakeCall* fake_call_; | 961 FakeCall* fake_call_; |
1002 rtc::scoped_ptr<VideoMediaChannel> channel_; | 962 rtc::scoped_ptr<VideoMediaChannel> channel_; |
1003 uint32 last_ssrc_; | 963 uint32 last_ssrc_; |
1004 }; | 964 }; |
1005 | 965 |
| 966 TEST_F(WebRtcVideoChannel2Test, SetsSyncGroupFromSyncLabel) { |
| 967 const uint32 kVideoSsrc = 123; |
| 968 const std::string kSyncLabel = "AvSyncLabel"; |
| 969 |
| 970 cricket::StreamParams sp = cricket::StreamParams::CreateLegacy(kVideoSsrc); |
| 971 sp.sync_label = kSyncLabel; |
| 972 EXPECT_TRUE(channel_->AddRecvStream(sp)); |
| 973 |
| 974 EXPECT_EQ(1, fake_call_->GetVideoReceiveStreams().size()); |
| 975 EXPECT_EQ(kSyncLabel, |
| 976 fake_call_->GetVideoReceiveStreams()[0]->GetConfig().sync_group) |
| 977 << "SyncGroup should be set based on sync_label"; |
| 978 } |
| 979 |
1006 TEST_F(WebRtcVideoChannel2Test, RecvStreamWithSimAndRtx) { | 980 TEST_F(WebRtcVideoChannel2Test, RecvStreamWithSimAndRtx) { |
1007 EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); | 981 EXPECT_TRUE(channel_->SetSendCodecs(engine_.codecs())); |
1008 EXPECT_TRUE(channel_->SetSend(true)); | 982 EXPECT_TRUE(channel_->SetSend(true)); |
1009 cricket::VideoOptions options; | 983 cricket::VideoOptions options; |
1010 options.conference_mode.Set(true); | 984 options.conference_mode.Set(true); |
1011 EXPECT_TRUE(channel_->SetOptions(options)); | 985 EXPECT_TRUE(channel_->SetOptions(options)); |
1012 | 986 |
1013 // Send side. | 987 // Send side. |
1014 const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); | 988 const std::vector<uint32> ssrcs = MAKE_VECTOR(kSsrcs1); |
1015 const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); | 989 const std::vector<uint32> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); |
(...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3082 // Ensures that the correct settings are applied to the codec when two temporal | 3056 // Ensures that the correct settings are applied to the codec when two temporal |
3083 // layer screencasting is enabled, and that the correct simulcast settings are | 3057 // layer screencasting is enabled, and that the correct simulcast settings are |
3084 // reapplied when disabling screencasting. | 3058 // reapplied when disabling screencasting. |
3085 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3059 TEST_F(WebRtcVideoChannel2SimulcastTest, |
3086 DISABLED_TwoTemporalLayerScreencastSettings) { | 3060 DISABLED_TwoTemporalLayerScreencastSettings) { |
3087 // TODO(pbos): Implement. | 3061 // TODO(pbos): Implement. |
3088 FAIL() << "Not implemented."; | 3062 FAIL() << "Not implemented."; |
3089 } | 3063 } |
3090 | 3064 |
3091 } // namespace cricket | 3065 } // namespace cricket |
OLD | NEW |