Chromium Code Reviews| Index: webrtc/voice_engine/voe_base_impl.cc |
| diff --git a/webrtc/voice_engine/voe_base_impl.cc b/webrtc/voice_engine/voe_base_impl.cc |
| index 1ddf53ca7b642bfb1ae07a5cb42c1eabcf118fe7..7275f6be4171c3470c276068c631478d0789ad3e 100644 |
| --- a/webrtc/voice_engine/voe_base_impl.cc |
| +++ b/webrtc/voice_engine/voe_base_impl.cc |
| @@ -225,8 +225,10 @@ int VoEBaseImpl::DeRegisterVoiceEngineObserver() { |
| int VoEBaseImpl::Init( |
| AudioDeviceModule* external_adm, |
| - AudioProcessing* audioproc, |
| + AudioProcessing* external_apm, |
| const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) { |
| + // TODO(peah): Add a DCHECK for external_apmwhen upstream dependencies have |
|
Taylor Brandstetter
2017/06/28 07:19:38
Here too, and space between "apm" and "when"
peah-webrtc
2017/06/29 11:46:31
Done.
|
| + // properly been resolved. |
| rtc::CritScope cs(shared_->crit_sec()); |
| WebRtcSpl_Init(); |
| if (shared_->statistics().Initialized()) { |
| @@ -337,33 +339,41 @@ int VoEBaseImpl::Init( |
| "Init() failed to set mono/stereo recording mode"); |
| } |
| - if (!audioproc) { |
| - audioproc = AudioProcessing::Create(); |
| - if (!audioproc) { |
| + // TODO(peah): Remove this when upstream dependencies have properly been |
| + // resolved. |
| + AudioProcessing* apm = nullptr; |
| + if (!external_apm) { |
| + audio_processing_ = AudioProcessing::Create(); |
| + if (!audio_processing_) { |
| LOG(LS_ERROR) << "Failed to create AudioProcessing."; |
| shared_->SetLastError(VE_NO_MEMORY); |
|
Taylor Brandstetter
2017/06/28 07:19:38
Can you add a comment explaining why failure to cr
peah-webrtc
2017/06/29 11:46:31
This makes sense and this is not clear at all. How
|
| return -1; |
| } |
| + apm = audio_processing_.get(); |
| + } else { |
| + apm = external_apm; |
| } |
| - shared_->set_audio_processing(audioproc); |
| + |
| + shared_->set_audio_processing(apm); |
| // Set the error state for any failures in this block. |
| shared_->SetLastError(VE_APM_ERROR); |
| // Configure AudioProcessing components. |
| - if (audioproc->high_pass_filter()->Enable(true) != 0) { |
| + // TODO(peah): Move this initialization to webrtcvoiceengine.cc. |
| + if (apm->high_pass_filter()->Enable(true) != 0) { |
| LOG_F(LS_ERROR) << "Failed to enable high pass filter."; |
| return -1; |
| } |
| - if (audioproc->echo_cancellation()->enable_drift_compensation(false) != 0) { |
| + if (apm->echo_cancellation()->enable_drift_compensation(false) != 0) { |
| LOG_F(LS_ERROR) << "Failed to disable drift compensation."; |
| return -1; |
| } |
| - if (audioproc->noise_suppression()->set_level(kDefaultNsMode) != 0) { |
| + if (apm->noise_suppression()->set_level(kDefaultNsMode) != 0) { |
| LOG_F(LS_ERROR) << "Failed to set noise suppression level: " |
| << kDefaultNsMode; |
| return -1; |
| } |
| - GainControl* agc = audioproc->gain_control(); |
| + GainControl* agc = apm->gain_control(); |
| if (agc->set_analog_level_limits(kMinVolumeLevel, kMaxVolumeLevel) != 0) { |
| LOG_F(LS_ERROR) << "Failed to set analog level limits with minimum: " |
| << kMinVolumeLevel << " and maximum: " << kMaxVolumeLevel; |
| @@ -687,9 +697,7 @@ int32_t VoEBaseImpl::TerminateInternal() { |
| shared_->set_audio_device(nullptr); |
| } |
| - if (shared_->audio_processing()) { |
| - shared_->set_audio_processing(nullptr); |
| - } |
| + shared_->set_audio_processing(nullptr); |
| return shared_->statistics().SetUnInitialized(); |
| } |