Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: webrtc/test/call_test.cc

Issue 2961723004: Allow an external audio processing module to be used in WebRTC (Closed)
Patch Set: Moved creation of APMs from CreateVoiceEngines Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/call_test.h ('k') | webrtc/test/mock_voice_engine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 void CallTest::RunBaseTest(BaseTest* test) { 49 void CallTest::RunBaseTest(BaseTest* test) {
50 num_video_streams_ = test->GetNumVideoStreams(); 50 num_video_streams_ = test->GetNumVideoStreams();
51 num_audio_streams_ = test->GetNumAudioStreams(); 51 num_audio_streams_ = test->GetNumAudioStreams();
52 num_flexfec_streams_ = test->GetNumFlexfecStreams(); 52 num_flexfec_streams_ = test->GetNumFlexfecStreams();
53 RTC_DCHECK(num_video_streams_ > 0 || num_audio_streams_ > 0); 53 RTC_DCHECK(num_video_streams_ > 0 || num_audio_streams_ > 0);
54 Call::Config send_config(test->GetSenderCallConfig()); 54 Call::Config send_config(test->GetSenderCallConfig());
55 if (num_audio_streams_ > 0) { 55 if (num_audio_streams_ > 0) {
56 CreateFakeAudioDevices(test->CreateCapturer(), test->CreateRenderer()); 56 CreateFakeAudioDevices(test->CreateCapturer(), test->CreateRenderer());
57 test->OnFakeAudioDevicesCreated(fake_send_audio_device_.get(), 57 test->OnFakeAudioDevicesCreated(fake_send_audio_device_.get(),
58 fake_recv_audio_device_.get()); 58 fake_recv_audio_device_.get());
59 apm_send_ = AudioProcessing::Create();
60 apm_recv_ = AudioProcessing::Create();
59 CreateVoiceEngines(); 61 CreateVoiceEngines();
60 AudioState::Config audio_state_config; 62 AudioState::Config audio_state_config;
61 audio_state_config.voice_engine = voe_send_.voice_engine; 63 audio_state_config.voice_engine = voe_send_.voice_engine;
62 audio_state_config.audio_mixer = AudioMixerImpl::Create(); 64 audio_state_config.audio_mixer = AudioMixerImpl::Create();
65 audio_state_config.audio_processing = apm_send_;
63 send_config.audio_state = AudioState::Create(audio_state_config); 66 send_config.audio_state = AudioState::Create(audio_state_config);
64 } 67 }
65 CreateSenderCall(send_config); 68 CreateSenderCall(send_config);
66 if (test->ShouldCreateReceivers()) { 69 if (test->ShouldCreateReceivers()) {
67 Call::Config recv_config(test->GetReceiverCallConfig()); 70 Call::Config recv_config(test->GetReceiverCallConfig());
68 if (num_audio_streams_ > 0) { 71 if (num_audio_streams_ > 0) {
69 AudioState::Config audio_state_config; 72 AudioState::Config audio_state_config;
70 audio_state_config.voice_engine = voe_recv_.voice_engine; 73 audio_state_config.voice_engine = voe_recv_.voice_engine;
71 audio_state_config.audio_mixer = AudioMixerImpl::Create(); 74 audio_state_config.audio_mixer = AudioMixerImpl::Create();
75 audio_state_config.audio_processing = apm_recv_;
72 recv_config.audio_state = AudioState::Create(audio_state_config); 76 recv_config.audio_state = AudioState::Create(audio_state_config);
73 } 77 }
74 CreateReceiverCall(recv_config); 78 CreateReceiverCall(recv_config);
75 } 79 }
76 test->OnCallsCreated(sender_call_.get(), receiver_call_.get()); 80 test->OnCallsCreated(sender_call_.get(), receiver_call_.get());
77 receive_transport_.reset(test->CreateReceiveTransport()); 81 receive_transport_.reset(test->CreateReceiveTransport());
78 send_transport_.reset(test->CreateSendTransport(sender_call_.get())); 82 send_transport_.reset(test->CreateSendTransport(sender_call_.get()));
79 83
80 if (test->ShouldCreateReceivers()) { 84 if (test->ShouldCreateReceivers()) {
81 send_transport_->SetReceiver(receiver_call_->Receiver()); 85 send_transport_->SetReceiver(receiver_call_->Receiver());
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) 375 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_)
372 receiver_call_->DestroyFlexfecReceiveStream(flexfec_recv_stream); 376 receiver_call_->DestroyFlexfecReceiveStream(flexfec_recv_stream);
373 377
374 video_receive_streams_.clear(); 378 video_receive_streams_.clear();
375 allocated_decoders_.clear(); 379 allocated_decoders_.clear();
376 } 380 }
377 381
378 void CallTest::CreateVoiceEngines() { 382 void CallTest::CreateVoiceEngines() {
379 voe_send_.voice_engine = VoiceEngine::Create(); 383 voe_send_.voice_engine = VoiceEngine::Create();
380 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); 384 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine);
381 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr, 385 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(),
382 decoder_factory_)); 386 apm_send_.get(), decoder_factory_));
383 VoEBase::ChannelConfig config; 387 VoEBase::ChannelConfig config;
384 config.enable_voice_pacing = true; 388 config.enable_voice_pacing = true;
385 voe_send_.channel_id = voe_send_.base->CreateChannel(config); 389 voe_send_.channel_id = voe_send_.base->CreateChannel(config);
386 EXPECT_GE(voe_send_.channel_id, 0); 390 EXPECT_GE(voe_send_.channel_id, 0);
387 391
388 voe_recv_.voice_engine = VoiceEngine::Create(); 392 voe_recv_.voice_engine = VoiceEngine::Create();
389 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine); 393 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine);
390 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), nullptr, 394 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(),
391 decoder_factory_)); 395 apm_recv_.get(), decoder_factory_));
392 voe_recv_.channel_id = voe_recv_.base->CreateChannel(); 396 voe_recv_.channel_id = voe_recv_.base->CreateChannel();
393 EXPECT_GE(voe_recv_.channel_id, 0); 397 EXPECT_GE(voe_recv_.channel_id, 0);
394 } 398 }
395 399
396 void CallTest::DestroyVoiceEngines() { 400 void CallTest::DestroyVoiceEngines() {
397 voe_recv_.base->DeleteChannel(voe_recv_.channel_id); 401 voe_recv_.base->DeleteChannel(voe_recv_.channel_id);
398 voe_recv_.channel_id = -1; 402 voe_recv_.channel_id = -1;
399 voe_recv_.base->Release(); 403 voe_recv_.base->Release();
400 voe_recv_.base = nullptr; 404 voe_recv_.base = nullptr;
401 405
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 547
544 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { 548 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
545 } 549 }
546 550
547 bool EndToEndTest::ShouldCreateReceivers() const { 551 bool EndToEndTest::ShouldCreateReceivers() const {
548 return true; 552 return true;
549 } 553 }
550 554
551 } // namespace test 555 } // namespace test
552 } // namespace webrtc 556 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/call_test.h ('k') | webrtc/test/mock_voice_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698