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

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

Issue 2948763002: Allow an external audio processing module to be used in WebRTC (Closed)
Patch Set: tracking linux32_rel issue Created 3 years, 6 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 CreateVoiceEngines(); 59 CreateVoiceEngines();
60 AudioState::Config audio_state_config; 60 AudioState::Config audio_state_config;
61 audio_state_config.voice_engine = voe_send_.voice_engine; 61 audio_state_config.voice_engine = voe_send_.voice_engine;
62 audio_state_config.audio_mixer = AudioMixerImpl::Create(); 62 audio_state_config.audio_mixer = AudioMixerImpl::Create();
63 audio_state_config.audio_processing = apm_send_;
63 send_config.audio_state = AudioState::Create(audio_state_config); 64 send_config.audio_state = AudioState::Create(audio_state_config);
64 } 65 }
65 CreateSenderCall(send_config); 66 CreateSenderCall(send_config);
66 if (test->ShouldCreateReceivers()) { 67 if (test->ShouldCreateReceivers()) {
67 Call::Config recv_config(test->GetReceiverCallConfig()); 68 Call::Config recv_config(test->GetReceiverCallConfig());
68 if (num_audio_streams_ > 0) { 69 if (num_audio_streams_ > 0) {
69 AudioState::Config audio_state_config; 70 AudioState::Config audio_state_config;
70 audio_state_config.voice_engine = voe_recv_.voice_engine; 71 audio_state_config.voice_engine = voe_recv_.voice_engine;
71 audio_state_config.audio_mixer = AudioMixerImpl::Create(); 72 audio_state_config.audio_mixer = AudioMixerImpl::Create();
73 audio_state_config.audio_processing = apm_recv_;
72 recv_config.audio_state = AudioState::Create(audio_state_config); 74 recv_config.audio_state = AudioState::Create(audio_state_config);
73 } 75 }
74 CreateReceiverCall(recv_config); 76 CreateReceiverCall(recv_config);
75 } 77 }
76 test->OnCallsCreated(sender_call_.get(), receiver_call_.get()); 78 test->OnCallsCreated(sender_call_.get(), receiver_call_.get());
77 receive_transport_.reset(test->CreateReceiveTransport()); 79 receive_transport_.reset(test->CreateReceiveTransport());
78 send_transport_.reset(test->CreateSendTransport(sender_call_.get())); 80 send_transport_.reset(test->CreateSendTransport(sender_call_.get()));
79 81
80 if (test->ShouldCreateReceivers()) { 82 if (test->ShouldCreateReceivers()) {
81 send_transport_->SetReceiver(receiver_call_->Receiver()); 83 send_transport_->SetReceiver(receiver_call_->Receiver());
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 receiver_call_->DestroyVideoReceiveStream(video_recv_stream); 371 receiver_call_->DestroyVideoReceiveStream(video_recv_stream);
370 372
371 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) 373 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_)
372 receiver_call_->DestroyFlexfecReceiveStream(flexfec_recv_stream); 374 receiver_call_->DestroyFlexfecReceiveStream(flexfec_recv_stream);
373 375
374 video_receive_streams_.clear(); 376 video_receive_streams_.clear();
375 allocated_decoders_.clear(); 377 allocated_decoders_.clear();
376 } 378 }
377 379
378 void CallTest::CreateVoiceEngines() { 380 void CallTest::CreateVoiceEngines() {
381 apm_send_ = AudioProcessing::Create();
379 voe_send_.voice_engine = VoiceEngine::Create(); 382 voe_send_.voice_engine = VoiceEngine::Create();
380 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); 383 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine);
381 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr, 384 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(),
382 decoder_factory_)); 385 apm_send_.get(), decoder_factory_));
383 VoEBase::ChannelConfig config; 386 VoEBase::ChannelConfig config;
384 config.enable_voice_pacing = true; 387 config.enable_voice_pacing = true;
385 voe_send_.channel_id = voe_send_.base->CreateChannel(config); 388 voe_send_.channel_id = voe_send_.base->CreateChannel(config);
386 EXPECT_GE(voe_send_.channel_id, 0); 389 EXPECT_GE(voe_send_.channel_id, 0);
387 390
391 apm_recv_ = AudioProcessing::Create();
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

Powered by Google App Engine
This is Rietveld 408576698