From f3e2bf18079f413f93c89d62b221e014366f9b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Thu, 22 Mar 2018 10:15:59 +0100 Subject: [PATCH] Further headset mode robustification based on linear filter convergence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL adds robustifications for avoiding that the headset mode is triggered for reverberant or weak echo paths. Bug: webrtc:9047,chromium:824111,webrtc:8314,webrtc:8671,webrtc:5201,webrtc:5919 Change-Id: Ib111e617f765377c021a5b633cf13a7917fe62a6 Reviewed-on: https://webrtc-review.googlesource.com/64002 Reviewed-by: Gustaf Ullberg Commit-Queue: Per Ã…hgren Cr-Commit-Position: refs/heads/master@{#22557} --- modules/audio_processing/aec3/aec_state.cc | 11 ++++++++++- modules/audio_processing/aec3/aec_state.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc index 3aaf986df9..3c3d095280 100644 --- a/modules/audio_processing/aec3/aec_state.cc +++ b/modules/audio_processing/aec3/aec_state.cc @@ -170,6 +170,15 @@ void AecState::Update( bool recently_converged_filter = blocks_since_converged_filter_ < 60 * kNumBlocksPerSecond; + if (blocks_since_converged_filter_ > 20 * kNumBlocksPerSecond) { + converged_filter_count_ = 0; + } else if (converged_filter) { + ++converged_filter_count_; + } + if (converged_filter_count_ > 50) { + finite_erl_ = true; + } + if (filter_analyzer_.Consistent() && filter_delay_blocks_ < 5) { consistent_filter_seen_ = true; active_blocks_since_consistent_filter_estimate_ = 0; @@ -192,7 +201,7 @@ void AecState::Update( // After an amount of active render samples for which an echo should have been // detected in the capture signal if the ERL was not infinite, flag that a // transparent mode should be entered. - transparent_mode_ = !config_.ep_strength.bounded_erl; + transparent_mode_ = !config_.ep_strength.bounded_erl && !finite_erl_; transparent_mode_ = transparent_mode_ && (consistent_filter_estimate_not_seen || !converged_filter_seen_); diff --git a/modules/audio_processing/aec3/aec_state.h b/modules/audio_processing/aec3/aec_state.h index 404183f4ab..9e7c7b2c1d 100644 --- a/modules/audio_processing/aec3/aec_state.h +++ b/modules/audio_processing/aec3/aec_state.h @@ -173,6 +173,8 @@ class AecState { bool converged_filter_seen_ = false; bool consistent_filter_seen_ = false; bool external_delay_seen_ = false; + size_t converged_filter_count_ = 0; + bool finite_erl_ = false; RTC_DISALLOW_COPY_AND_ASSIGN(AecState); };