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

Side by Side Diff: webrtc/call/call_unittest.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) 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
(...skipping 19 matching lines...) Expand all
30 30
31 namespace { 31 namespace {
32 32
33 struct CallHelper { 33 struct CallHelper {
34 explicit CallHelper( 34 explicit CallHelper(
35 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory = nullptr) 35 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory = nullptr)
36 : voice_engine_(decoder_factory) { 36 : voice_engine_(decoder_factory) {
37 webrtc::AudioState::Config audio_state_config; 37 webrtc::AudioState::Config audio_state_config;
38 audio_state_config.voice_engine = &voice_engine_; 38 audio_state_config.voice_engine = &voice_engine_;
39 audio_state_config.audio_mixer = webrtc::AudioMixerImpl::Create(); 39 audio_state_config.audio_mixer = webrtc::AudioMixerImpl::Create();
40 audio_state_config.audio_processing = webrtc::AudioProcessing::Create();
40 EXPECT_CALL(voice_engine_, audio_device_module()); 41 EXPECT_CALL(voice_engine_, audio_device_module());
41 EXPECT_CALL(voice_engine_, audio_processing());
42 EXPECT_CALL(voice_engine_, audio_transport()); 42 EXPECT_CALL(voice_engine_, audio_transport());
43 webrtc::Call::Config config(&event_log_); 43 webrtc::Call::Config config(&event_log_);
44 config.audio_state = webrtc::AudioState::Create(audio_state_config); 44 config.audio_state = webrtc::AudioState::Create(audio_state_config);
45 call_.reset(webrtc::Call::Create(config)); 45 call_.reset(webrtc::Call::Create(config));
46 } 46 }
47 47
48 webrtc::Call* operator->() { return call_.get(); } 48 webrtc::Call* operator->() { return call_.get(); }
49 webrtc::test::MockVoiceEngine* voice_engine() { return &voice_engine_; } 49 webrtc::test::MockVoiceEngine* voice_engine() { return &voice_engine_; }
50 50
51 private: 51 private:
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 ~ScopedVoiceEngine() { 446 ~ScopedVoiceEngine() {
447 base->Release(); 447 base->Release();
448 EXPECT_TRUE(VoiceEngine::Delete(voe)); 448 EXPECT_TRUE(VoiceEngine::Delete(voe));
449 } 449 }
450 450
451 VoiceEngine* voe; 451 VoiceEngine* voe;
452 VoEBase* base; 452 VoEBase* base;
453 }; 453 };
454 ScopedVoiceEngine voice_engine; 454 ScopedVoiceEngine voice_engine;
455 455
456 voice_engine.base->Init(&mock_adm);
457 AudioState::Config audio_state_config; 456 AudioState::Config audio_state_config;
458 audio_state_config.voice_engine = voice_engine.voe; 457 audio_state_config.voice_engine = voice_engine.voe;
459 audio_state_config.audio_mixer = mock_mixer; 458 audio_state_config.audio_mixer = mock_mixer;
459 audio_state_config.audio_processing = AudioProcessing::Create();
460 voice_engine.base->Init(&mock_adm, audio_state_config.audio_processing.get());
460 auto audio_state = AudioState::Create(audio_state_config); 461 auto audio_state = AudioState::Create(audio_state_config);
462
461 RtcEventLogNullImpl event_log; 463 RtcEventLogNullImpl event_log;
462 Call::Config call_config(&event_log); 464 Call::Config call_config(&event_log);
463 call_config.audio_state = audio_state; 465 call_config.audio_state = audio_state;
464 std::unique_ptr<Call> call(Call::Create(call_config)); 466 std::unique_ptr<Call> call(Call::Create(call_config));
465 467
466 auto create_stream_and_get_rtp_state = [&](uint32_t ssrc) { 468 auto create_stream_and_get_rtp_state = [&](uint32_t ssrc) {
467 AudioSendStream::Config config(nullptr); 469 AudioSendStream::Config config(nullptr);
468 config.rtp.ssrc = ssrc; 470 config.rtp.ssrc = ssrc;
469 config.voe_channel_id = voice_engine.base->CreateChannel(); 471 config.voe_channel_id = voice_engine.base->CreateChannel();
470 AudioSendStream* stream = call->CreateAudioSendStream(config); 472 AudioSendStream* stream = call->CreateAudioSendStream(config);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 mask.min_bitrate_bps = rtc::Optional<int>(2000); 706 mask.min_bitrate_bps = rtc::Optional<int>(2000);
705 EXPECT_CALL(call.mock_cc(), SetBweBitrates(1000, -1, 1000)); 707 EXPECT_CALL(call.mock_cc(), SetBweBitrates(1000, -1, 1000));
706 call->SetBitrateConfigMask(mask); 708 call->SetBitrateConfigMask(mask);
707 709
708 // Set min to 3000; the clamped value stays the same so nothing happens. 710 // Set min to 3000; the clamped value stays the same so nothing happens.
709 mask.min_bitrate_bps = rtc::Optional<int>(3000); 711 mask.min_bitrate_bps = rtc::Optional<int>(3000);
710 call->SetBitrateConfigMask(mask); 712 call->SetBitrateConfigMask(mask);
711 } 713 }
712 714
713 } // namespace webrtc 715 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698