From ced31ba1cfb97abaabb4c3d19e28a60554c3dddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= <peah@webrtc.org> Date: Wed, 9 May 2018 11:48:49 +0200 Subject: [PATCH] Correcting the usage of the estimated echo path gain in AEC3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL corrects the usage of the estimated echo path gain to not be hardcoded to 1. In order to retain the tuned behavior, the CL for now maintains the former behavior in the code. Bug: webrtc:9255,chromium:851187 Change-Id: I7f91c72e476680a8a854c22b74b1771fae446110 Reviewed-on: https://webrtc-review.googlesource.com/75510 Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org> Commit-Queue: Per Ã…hgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23190} --- api/audio/echo_canceller3_config.h | 6 +++--- modules/audio_processing/aec3/aec_state.h | 2 +- .../aec3/residual_echo_estimator.cc | 19 +++++++++++++++---- .../aec3/residual_echo_estimator.h | 1 + 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/api/audio/echo_canceller3_config.h b/api/audio/echo_canceller3_config.h index 55665caa33..592dce4550 100644 --- a/api/audio/echo_canceller3_config.h +++ b/api/audio/echo_canceller3_config.h @@ -62,9 +62,9 @@ struct EchoCanceller3Config { } erle; struct EpStrength { - float lf = 10.f; - float mf = 10.f; - float hf = 10.f; + float lf = 1.f; + float mf = 1.f; + float hf = 1.f; float default_len = 0.f; bool echo_can_saturate = true; bool bounded_erl = false; diff --git a/modules/audio_processing/aec3/aec_state.h b/modules/audio_processing/aec3/aec_state.h index ebfa62f062..4f5c8717b1 100644 --- a/modules/audio_processing/aec3/aec_state.h +++ b/modules/audio_processing/aec3/aec_state.h @@ -49,7 +49,7 @@ class AecState { bool UseLinearFilterOutput() const { return use_linear_filter_output_; } // Returns the estimated echo path gain. - bool EchoPathGain() const { return filter_analyzer_.Gain(); } + float EchoPathGain() const { return filter_analyzer_.Gain(); } // Returns whether the render signal is currently active. bool ActiveRender() const { return blocks_with_active_render_ > 200; } diff --git a/modules/audio_processing/aec3/residual_echo_estimator.cc b/modules/audio_processing/aec3/residual_echo_estimator.cc index 19f65d098e..da152e9f70 100644 --- a/modules/audio_processing/aec3/residual_echo_estimator.cc +++ b/modules/audio_processing/aec3/residual_echo_estimator.cc @@ -24,12 +24,17 @@ bool EnableSoftTransparentMode() { return !field_trial::IsEnabled("WebRTC-Aec3SoftTransparentModeKillSwitch"); } +bool OverrideEstimatedEchoPathGain() { + return !field_trial::IsEnabled("WebRTC-Aec3OverrideEchoPathGainKillSwitch"); +} + } // namespace ResidualEchoEstimator::ResidualEchoEstimator(const EchoCanceller3Config& config) : config_(config), S2_old_(config_.filter.main.length_blocks), - soft_transparent_mode_(EnableSoftTransparentMode()) { + soft_transparent_mode_(EnableSoftTransparentMode()), + override_estimated_echo_path_gain_(OverrideEstimatedEchoPathGain()) { Reset(); } @@ -74,9 +79,15 @@ void ResidualEchoEstimator::Estimate( 0.f, a - config_.echo_model.stationary_gate_slope * b); }); - float echo_path_gain = aec_state.TransparentMode() && soft_transparent_mode_ - ? 0.01f - : aec_state.EchoPathGain(); + float echo_path_gain; + if (override_estimated_echo_path_gain_) { + echo_path_gain = + aec_state.TransparentMode() && soft_transparent_mode_ ? 0.01f : 1.f; + } else { + echo_path_gain = aec_state.TransparentMode() && soft_transparent_mode_ + ? 0.01f + : aec_state.EchoPathGain(); + } NonLinearEstimate(echo_path_gain, X2, Y2, R2); // If the echo is saturated, estimate the echo power as the maximum echo diff --git a/modules/audio_processing/aec3/residual_echo_estimator.h b/modules/audio_processing/aec3/residual_echo_estimator.h index d03b89a464..5c8ba55368 100644 --- a/modules/audio_processing/aec3/residual_echo_estimator.h +++ b/modules/audio_processing/aec3/residual_echo_estimator.h @@ -83,6 +83,7 @@ class ResidualEchoEstimator { std::array<float, kFftLengthBy2Plus1> X2_noise_floor_; std::array<int, kFftLengthBy2Plus1> X2_noise_floor_counter_; const bool soft_transparent_mode_; + const bool override_estimated_echo_path_gain_; RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ResidualEchoEstimator); };