OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
11 #include <list> | 11 #include <list> |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 #include "webrtc/call/audio_state.h" | 14 #include "webrtc/call/audio_state.h" |
15 #include "webrtc/call/call.h" | 15 #include "webrtc/call/call.h" |
16 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 16 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
17 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h" | 17 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h" |
18 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 18 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
19 #include "webrtc/test/gtest.h" | 19 #include "webrtc/test/gtest.h" |
| 20 #include "webrtc/test/mock_transport.h" |
20 #include "webrtc/test/mock_voice_engine.h" | 21 #include "webrtc/test/mock_voice_engine.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 struct CallHelper { | 25 struct CallHelper { |
25 explicit CallHelper( | 26 explicit CallHelper( |
26 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory = nullptr) | 27 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory = nullptr) |
27 : voice_engine_(decoder_factory) { | 28 : voice_engine_(decoder_factory) { |
28 webrtc::AudioState::Config audio_state_config; | 29 webrtc::AudioState::Config audio_state_config; |
29 audio_state_config.voice_engine = &voice_engine_; | 30 audio_state_config.voice_engine = &voice_engine_; |
(...skipping 185 matching lines...) Loading... |
215 EXPECT_NE(recv_stream, nullptr); | 216 EXPECT_NE(recv_stream, nullptr); |
216 | 217 |
217 EXPECT_CALL(*recv_channel_proxy, DisassociateSendChannel()).Times(1); | 218 EXPECT_CALL(*recv_channel_proxy, DisassociateSendChannel()).Times(1); |
218 call->DestroyAudioReceiveStream(recv_stream); | 219 call->DestroyAudioReceiveStream(recv_stream); |
219 | 220 |
220 call->DestroyAudioSendStream(send_stream); | 221 call->DestroyAudioSendStream(send_stream); |
221 } | 222 } |
222 | 223 |
223 TEST(CallTest, CreateDestroy_FlexfecReceiveStream) { | 224 TEST(CallTest, CreateDestroy_FlexfecReceiveStream) { |
224 CallHelper call; | 225 CallHelper call; |
225 FlexfecReceiveStream::Config config; | 226 MockTransport rtcp_send_transport; |
| 227 FlexfecReceiveStream::Config config(&rtcp_send_transport); |
226 config.payload_type = 118; | 228 config.payload_type = 118; |
227 config.remote_ssrc = 38837212; | 229 config.remote_ssrc = 38837212; |
228 config.protected_media_ssrcs = {27273}; | 230 config.protected_media_ssrcs = {27273}; |
229 | 231 |
230 FlexfecReceiveStream* stream = call->CreateFlexfecReceiveStream(config); | 232 FlexfecReceiveStream* stream = call->CreateFlexfecReceiveStream(config); |
231 EXPECT_NE(stream, nullptr); | 233 EXPECT_NE(stream, nullptr); |
232 call->DestroyFlexfecReceiveStream(stream); | 234 call->DestroyFlexfecReceiveStream(stream); |
233 } | 235 } |
234 | 236 |
235 TEST(CallTest, CreateDestroy_FlexfecReceiveStreams) { | 237 TEST(CallTest, CreateDestroy_FlexfecReceiveStreams) { |
236 CallHelper call; | 238 CallHelper call; |
237 FlexfecReceiveStream::Config config; | 239 MockTransport rtcp_send_transport; |
| 240 FlexfecReceiveStream::Config config(&rtcp_send_transport); |
238 config.payload_type = 118; | 241 config.payload_type = 118; |
239 std::list<FlexfecReceiveStream*> streams; | 242 std::list<FlexfecReceiveStream*> streams; |
240 | 243 |
241 for (int i = 0; i < 2; ++i) { | 244 for (int i = 0; i < 2; ++i) { |
242 for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) { | 245 for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) { |
243 config.remote_ssrc = ssrc; | 246 config.remote_ssrc = ssrc; |
244 config.protected_media_ssrcs = {ssrc + 1}; | 247 config.protected_media_ssrcs = {ssrc + 1}; |
245 FlexfecReceiveStream* stream = call->CreateFlexfecReceiveStream(config); | 248 FlexfecReceiveStream* stream = call->CreateFlexfecReceiveStream(config); |
246 EXPECT_NE(stream, nullptr); | 249 EXPECT_NE(stream, nullptr); |
247 if (ssrc & 1) { | 250 if (ssrc & 1) { |
248 streams.push_back(stream); | 251 streams.push_back(stream); |
249 } else { | 252 } else { |
250 streams.push_front(stream); | 253 streams.push_front(stream); |
251 } | 254 } |
252 } | 255 } |
253 for (auto s : streams) { | 256 for (auto s : streams) { |
254 call->DestroyFlexfecReceiveStream(s); | 257 call->DestroyFlexfecReceiveStream(s); |
255 } | 258 } |
256 streams.clear(); | 259 streams.clear(); |
257 } | 260 } |
258 } | 261 } |
259 | 262 |
260 TEST(CallTest, MultipleFlexfecReceiveStreamsProtectingSingleVideoStream) { | 263 TEST(CallTest, MultipleFlexfecReceiveStreamsProtectingSingleVideoStream) { |
261 CallHelper call; | 264 CallHelper call; |
262 FlexfecReceiveStream::Config config; | 265 MockTransport rtcp_send_transport; |
| 266 FlexfecReceiveStream::Config config(&rtcp_send_transport); |
263 config.payload_type = 118; | 267 config.payload_type = 118; |
264 config.protected_media_ssrcs = {1324234}; | 268 config.protected_media_ssrcs = {1324234}; |
265 FlexfecReceiveStream* stream; | 269 FlexfecReceiveStream* stream; |
266 std::list<FlexfecReceiveStream*> streams; | 270 std::list<FlexfecReceiveStream*> streams; |
267 | 271 |
268 config.remote_ssrc = 838383; | 272 config.remote_ssrc = 838383; |
269 stream = call->CreateFlexfecReceiveStream(config); | 273 stream = call->CreateFlexfecReceiveStream(config); |
270 EXPECT_NE(stream, nullptr); | 274 EXPECT_NE(stream, nullptr); |
271 streams.push_back(stream); | 275 streams.push_back(stream); |
272 | 276 |
(...skipping 11 matching lines...) Loading... |
284 stream = call->CreateFlexfecReceiveStream(config); | 288 stream = call->CreateFlexfecReceiveStream(config); |
285 EXPECT_NE(stream, nullptr); | 289 EXPECT_NE(stream, nullptr); |
286 streams.push_back(stream); | 290 streams.push_back(stream); |
287 | 291 |
288 for (auto s : streams) { | 292 for (auto s : streams) { |
289 call->DestroyFlexfecReceiveStream(s); | 293 call->DestroyFlexfecReceiveStream(s); |
290 } | 294 } |
291 } | 295 } |
292 | 296 |
293 } // namespace webrtc | 297 } // namespace webrtc |
OLD | NEW |