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;