OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 #include "webrtc/base/checks.h" | 10 #include "webrtc/base/checks.h" |
11 #include "webrtc/common.h" | 11 #include "webrtc/common.h" |
12 #include "webrtc/config.h" | 12 #include "webrtc/config.h" |
13 #include "webrtc/test/call_test.h" | 13 #include "webrtc/test/call_test.h" |
14 #include "webrtc/test/encoder_settings.h" | 14 #include "webrtc/test/encoder_settings.h" |
15 #include "webrtc/test/testsupport/fileutils.h" | 15 #include "webrtc/test/testsupport/fileutils.h" |
16 #include "webrtc/voice_engine/include/voe_base.h" | 16 #include "webrtc/voice_engine/include/voe_base.h" |
17 #include "webrtc/voice_engine/include/voe_codec.h" | 17 #include "webrtc/voice_engine/include/voe_codec.h" |
18 #include "webrtc/voice_engine/include/voe_network.h" | |
19 | 18 |
20 namespace webrtc { | 19 namespace webrtc { |
21 namespace test { | 20 namespace test { |
22 | 21 |
23 namespace { | 22 namespace { |
24 const int kVideoRotationRtpExtensionId = 4; | 23 const int kVideoRotationRtpExtensionId = 4; |
25 } | 24 } |
26 | 25 |
27 CallTest::CallTest() | 26 CallTest::CallTest() |
28 : clock_(Clock::GetRealTimeClock()), | 27 : clock_(Clock::GetRealTimeClock()), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Sender-only call delivers to itself. | 70 // Sender-only call delivers to itself. |
72 send_transport_->SetReceiver(sender_call_->Receiver()); | 71 send_transport_->SetReceiver(sender_call_->Receiver()); |
73 receive_transport_->SetReceiver(nullptr); | 72 receive_transport_->SetReceiver(nullptr); |
74 } | 73 } |
75 | 74 |
76 CreateSendConfig(num_video_streams_, num_audio_streams_, | 75 CreateSendConfig(num_video_streams_, num_audio_streams_, |
77 send_transport_.get()); | 76 send_transport_.get()); |
78 if (test->ShouldCreateReceivers()) { | 77 if (test->ShouldCreateReceivers()) { |
79 CreateMatchingReceiveConfigs(receive_transport_.get()); | 78 CreateMatchingReceiveConfigs(receive_transport_.get()); |
80 } | 79 } |
81 if (num_audio_streams_ > 0) | |
82 SetupVoiceEngineTransports(send_transport_.get(), receive_transport_.get()); | |
83 | |
84 if (num_video_streams_ > 0) { | 80 if (num_video_streams_ > 0) { |
85 test->ModifyVideoConfigs(&video_send_config_, &video_receive_configs_, | 81 test->ModifyVideoConfigs(&video_send_config_, &video_receive_configs_, |
86 &video_encoder_config_); | 82 &video_encoder_config_); |
87 } | 83 } |
88 if (num_audio_streams_ > 0) | 84 if (num_audio_streams_ > 0) |
89 test->ModifyAudioConfigs(&audio_send_config_, &audio_receive_configs_); | 85 test->ModifyAudioConfigs(&audio_send_config_, &audio_receive_configs_); |
90 | 86 |
91 if (num_video_streams_ > 0) { | 87 if (num_video_streams_ > 0) { |
92 CreateVideoStreams(); | 88 CreateVideoStreams(); |
93 test->OnVideoStreamsCreated(video_send_stream_, video_receive_streams_); | 89 test->OnVideoStreamsCreated(video_send_stream_, video_receive_streams_); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 receiver_call_->DestroyAudioReceiveStream(audio_recv_stream); | 299 receiver_call_->DestroyAudioReceiveStream(audio_recv_stream); |
304 video_receive_streams_.clear(); | 300 video_receive_streams_.clear(); |
305 | 301 |
306 allocated_decoders_.clear(); | 302 allocated_decoders_.clear(); |
307 } | 303 } |
308 | 304 |
309 void CallTest::CreateVoiceEngines() { | 305 void CallTest::CreateVoiceEngines() { |
310 CreateFakeAudioDevices(); | 306 CreateFakeAudioDevices(); |
311 voe_send_.voice_engine = VoiceEngine::Create(); | 307 voe_send_.voice_engine = VoiceEngine::Create(); |
312 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); | 308 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); |
313 voe_send_.network = VoENetwork::GetInterface(voe_send_.voice_engine); | |
314 voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine); | 309 voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine); |
315 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr)); | 310 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr)); |
316 Config voe_config; | 311 Config voe_config; |
317 voe_config.Set<VoicePacing>(new VoicePacing(true)); | 312 voe_config.Set<VoicePacing>(new VoicePacing(true)); |
318 voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config); | 313 voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config); |
319 EXPECT_GE(voe_send_.channel_id, 0); | 314 EXPECT_GE(voe_send_.channel_id, 0); |
320 | 315 |
321 voe_recv_.voice_engine = VoiceEngine::Create(); | 316 voe_recv_.voice_engine = VoiceEngine::Create(); |
322 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine); | 317 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine); |
323 voe_recv_.network = VoENetwork::GetInterface(voe_recv_.voice_engine); | |
324 voe_recv_.codec = VoECodec::GetInterface(voe_recv_.voice_engine); | 318 voe_recv_.codec = VoECodec::GetInterface(voe_recv_.voice_engine); |
325 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), nullptr)); | 319 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), nullptr)); |
326 voe_recv_.channel_id = voe_recv_.base->CreateChannel(); | 320 voe_recv_.channel_id = voe_recv_.base->CreateChannel(); |
327 EXPECT_GE(voe_recv_.channel_id, 0); | 321 EXPECT_GE(voe_recv_.channel_id, 0); |
328 } | 322 } |
329 | 323 |
330 void CallTest::SetupVoiceEngineTransports(PacketTransport* send_transport, | |
331 PacketTransport* recv_transport) { | |
332 voe_send_.transport_adapter.reset( | |
333 new internal::TransportAdapter(send_transport)); | |
334 voe_send_.transport_adapter->Enable(); | |
335 EXPECT_EQ(0, voe_send_.network->RegisterExternalTransport( | |
336 voe_send_.channel_id, *voe_send_.transport_adapter.get())); | |
337 | |
338 voe_recv_.transport_adapter.reset( | |
339 new internal::TransportAdapter(recv_transport)); | |
340 voe_recv_.transport_adapter->Enable(); | |
341 EXPECT_EQ(0, voe_recv_.network->RegisterExternalTransport( | |
342 voe_recv_.channel_id, *voe_recv_.transport_adapter.get())); | |
343 } | |
344 | |
345 void CallTest::DestroyVoiceEngines() { | 324 void CallTest::DestroyVoiceEngines() { |
346 voe_recv_.base->DeleteChannel(voe_recv_.channel_id); | 325 voe_recv_.base->DeleteChannel(voe_recv_.channel_id); |
347 voe_recv_.channel_id = -1; | 326 voe_recv_.channel_id = -1; |
348 voe_recv_.base->Release(); | 327 voe_recv_.base->Release(); |
349 voe_recv_.base = nullptr; | 328 voe_recv_.base = nullptr; |
350 voe_recv_.network->Release(); | |
351 voe_recv_.network = nullptr; | |
352 voe_recv_.codec->Release(); | 329 voe_recv_.codec->Release(); |
353 voe_recv_.codec = nullptr; | 330 voe_recv_.codec = nullptr; |
354 | 331 |
355 voe_send_.base->DeleteChannel(voe_send_.channel_id); | 332 voe_send_.base->DeleteChannel(voe_send_.channel_id); |
356 voe_send_.channel_id = -1; | 333 voe_send_.channel_id = -1; |
357 voe_send_.base->Release(); | 334 voe_send_.base->Release(); |
358 voe_send_.base = nullptr; | 335 voe_send_.base = nullptr; |
359 voe_send_.network->Release(); | |
360 voe_send_.network = nullptr; | |
361 voe_send_.codec->Release(); | 336 voe_send_.codec->Release(); |
362 voe_send_.codec = nullptr; | 337 voe_send_.codec = nullptr; |
363 | 338 |
364 VoiceEngine::Delete(voe_send_.voice_engine); | 339 VoiceEngine::Delete(voe_send_.voice_engine); |
365 voe_send_.voice_engine = nullptr; | 340 voe_send_.voice_engine = nullptr; |
366 VoiceEngine::Delete(voe_recv_.voice_engine); | 341 VoiceEngine::Delete(voe_recv_.voice_engine); |
367 voe_recv_.voice_engine = nullptr; | 342 voe_recv_.voice_engine = nullptr; |
368 } | 343 } |
369 | 344 |
370 const int CallTest::kDefaultTimeoutMs = 30 * 1000; | 345 const int CallTest::kDefaultTimeoutMs = 30 * 1000; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 425 |
451 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { | 426 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { |
452 } | 427 } |
453 | 428 |
454 bool EndToEndTest::ShouldCreateReceivers() const { | 429 bool EndToEndTest::ShouldCreateReceivers() const { |
455 return true; | 430 return true; |
456 } | 431 } |
457 | 432 |
458 } // namespace test | 433 } // namespace test |
459 } // namespace webrtc | 434 } // namespace webrtc |
OLD | NEW |