From 1d83f1e89f3e54b38d49ff877c763d0ac52fdb8b Mon Sep 17 00:00:00 2001 From: Bjorn Volcker Date: Tue, 7 Apr 2015 15:25:39 +0200 Subject: [PATCH] talk/media/webrtc/webrtcvoiceengine: Delay Agnostic AEC should not override HW-AEC In https://webrtc-codereview.appspot.com/48699004/ I made the audio option delay_agnostic_aec override HW-AEC if such exists. That is not an expected behavior and is fixed in this CL. In addition we now check if EnableBuiltInAEC() was successful before disabling the SW-AEC. This revealed a bug in that return value, also fixed here. BUG=4472 R=henrika@webrtc.org, perkj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/47969004 Cr-Commit-Position: refs/heads/master@{#8936} --- talk/media/webrtc/webrtcvoiceengine.cc | 11 ++++------- webrtc/voice_engine/voe_hardware_impl.cc | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc index 592d4ac68e..32a80bb456 100644 --- a/talk/media/webrtc/webrtcvoiceengine.cc +++ b/talk/media/webrtc/webrtcvoiceengine.cc @@ -848,13 +848,10 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { // in combination with Open SL ES audio. const bool built_in_aec = voe_wrapper_->hw()->BuiltInAECIsAvailable(); if (built_in_aec) { - // Enabled built-in EC if the device has one and delay agnostic AEC is not - // enabled. - const bool enable_built_in_aec = echo_cancellation & - !use_delay_agnostic_aec; - // Set mode of built-in EC according to the audio options. - voe_wrapper_->hw()->EnableBuiltInAEC(enable_built_in_aec); - if (enable_built_in_aec) { + // Built-in EC exists on this device. Enable/Disable it according to the + // echo_cancellation audio option. + if (voe_wrapper_->hw()->EnableBuiltInAEC(echo_cancellation) == 0 && + echo_cancellation) { // Disable internal software EC if built-in EC is enabled, // i.e., replace the software EC with the built-in EC. options.echo_cancellation.Set(false); diff --git a/webrtc/voice_engine/voe_hardware_impl.cc b/webrtc/voice_engine/voe_hardware_impl.cc index 2099562e2d..e8388ee146 100644 --- a/webrtc/voice_engine/voe_hardware_impl.cc +++ b/webrtc/voice_engine/voe_hardware_impl.cc @@ -579,7 +579,7 @@ if (!_shared->statistics().Initialized()) { int VoEHardwareImpl::EnableBuiltInAEC(bool enable) { if (!_shared->statistics().Initialized()) { _shared->SetLastError(VE_NOT_INITED, kTraceError); - return false; + return -1; } return _shared->audio_device()->EnableBuiltInAEC(enable); }