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); };