From b2d7116733902b9e9068992e172d72d870e54e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Mon, 10 Sep 2018 14:10:34 +0200 Subject: [PATCH] AEC3: Correction of the suppressor behavior at delay changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL adjusts the behavior of the AEC3 echo suppressor behavior initially in the call, and when there has been delay changes. The results is that short echo blips/bursts present in some such cases no longer occur. In particular this CL: -Ensures that the suppressor back-off under stationary render conditions does not occur until the linear filter has had the ability to converge. -Ensures that a previously converged filter behavior detection is not sticky for stable and linear echo paths, which in turn prevents echo leakage due to the more liberal echo suppressor behavior applied on such platforms. -Removes a bug that caused a random and jittery behavior for the usage of the linear filter output initially in the calls and after echo path changes Bug: webrtc:9737, chromium:882396 Change-Id: Id2b46e366dc58ab8137f19ed59a2034c89ca3087 Reviewed-on: https://webrtc-review.googlesource.com/99063 Commit-Queue: Per Ã…hgren Reviewed-by: Jesus de Vicente Pena Cr-Commit-Position: refs/heads/master@{#24656} --- modules/audio_processing/aec3/aec_state.cc | 7 +++---- modules/audio_processing/aec3/aec_state.h | 3 ++- modules/audio_processing/aec3/echo_audibility.h | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc index ffd81b3c11..5c2157dcb1 100644 --- a/modules/audio_processing/aec3/aec_state.cc +++ b/modules/audio_processing/aec3/aec_state.cc @@ -155,6 +155,9 @@ void AecState::HandleEchoPathChange( suppression_gain_limiter_.Reset(); blocks_since_converged_filter_ = kBlocksSinceConvergencedFilterInit; diverged_blocks_ = 0; + if (config_.echo_removal_control.linear_and_stable_echo_path) { + converged_filter_seen_ = false; + } if (reset_erle_after_echo_path_changes_) { erle_estimator_.Reset(); } @@ -262,10 +265,6 @@ void AecState::Update( blocks_with_proper_filter_adaptation_ >= 1.5f * kNumBlocksPerSecond; } - if (converged_filter && early_entry_to_converged_mode_) { - filter_has_had_time_to_converge_ = true; - } - if (!filter_should_have_converged_) { filter_should_have_converged_ = blocks_with_proper_filter_adaptation_ > 6 * kNumBlocksPerSecond; diff --git a/modules/audio_processing/aec3/aec_state.h b/modules/audio_processing/aec3/aec_state.h index ea30daf0ea..45ed09fa3a 100644 --- a/modules/audio_processing/aec3/aec_state.h +++ b/modules/audio_processing/aec3/aec_state.h @@ -60,7 +60,8 @@ class AecState { // Returns the appropriate scaling of the residual echo to match the // audibility. void GetResidualEchoScaling(rtc::ArrayView residual_scaling) const { - echo_audibility_.GetResidualEchoScaling(residual_scaling); + echo_audibility_.GetResidualEchoScaling(filter_has_had_time_to_converge_, + residual_scaling); } // Returns whether the stationary properties of the signals are used in the diff --git a/modules/audio_processing/aec3/echo_audibility.h b/modules/audio_processing/aec3/echo_audibility.h index 03bcd71865..3b252f3ea2 100644 --- a/modules/audio_processing/aec3/echo_audibility.h +++ b/modules/audio_processing/aec3/echo_audibility.h @@ -39,11 +39,12 @@ class EchoAudibility { int delay_blocks, bool external_delay_seen, float reverb_decay); - // Get the residual echo scaling. - void GetResidualEchoScaling(rtc::ArrayView residual_scaling) const { + void GetResidualEchoScaling(bool filter_has_had_time_to_converge, + rtc::ArrayView residual_scaling) const { for (size_t band = 0; band < residual_scaling.size(); ++band) { - if (render_stationarity_.IsBandStationary(band)) { + if (render_stationarity_.IsBandStationary(band) && + filter_has_had_time_to_converge) { residual_scaling[band] = 0.f; } else { residual_scaling[band] = 1.0f;