From c3da6716d42ddc714a719f32416e13a72001709a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Fri, 17 Aug 2018 00:09:15 +0200 Subject: [PATCH] AEC3: Adding another config parameter and matching json reader with config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL: -Adds another config parameter that controls the duration of the initial state. -Adds reading of that parameter in audioproc_f from the json settings file. -Adds missing reading of another parameter in audioproc_f from the json settings file. Bug: webrtc:8671 Change-Id: Ie6164c360492de5e6b0ade8838bbabe214560b5e Reviewed-on: https://webrtc-review.googlesource.com/94621 Reviewed-by: Jesus de Vicente Pena Commit-Queue: Per Ã…hgren Cr-Commit-Position: refs/heads/master@{#24360} --- api/audio/echo_canceller3_config.h | 1 + modules/audio_processing/aec3/aec_state.cc | 4 ++-- modules/audio_processing/test/audio_processing_simulator.cc | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/audio/echo_canceller3_config.h b/api/audio/echo_canceller3_config.h index a3e6545865..6eb91aa845 100644 --- a/api/audio/echo_canceller3_config.h +++ b/api/audio/echo_canceller3_config.h @@ -53,6 +53,7 @@ struct EchoCanceller3Config { ShadowConfiguration shadow_initial = {12, 0.9f, 20075344.f}; size_t config_change_duration_blocks = 250; + float initial_state_seconds = 2.5f; } filter; struct Erle { diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc index afeea4bee9..09a42bff58 100644 --- a/modules/audio_processing/aec3/aec_state.cc +++ b/modules/audio_processing/aec3/aec_state.cc @@ -284,8 +284,8 @@ void AecState::Update( // Flag whether the initial state is still active. if (use_short_initial_state_) { - initial_state_ = - blocks_with_proper_filter_adaptation_ < 2.5f * kNumBlocksPerSecond; + initial_state_ = blocks_with_proper_filter_adaptation_ < + config_.filter.initial_state_seconds * kNumBlocksPerSecond; } else { initial_state_ = blocks_with_proper_filter_adaptation_ < 5 * kNumBlocksPerSecond; diff --git a/modules/audio_processing/test/audio_processing_simulator.cc b/modules/audio_processing/test/audio_processing_simulator.cc index 54f38bc271..9a353bd189 100644 --- a/modules/audio_processing/test/audio_processing_simulator.cc +++ b/modules/audio_processing/test/audio_processing_simulator.cc @@ -210,6 +210,10 @@ EchoCanceller3Config ParseAec3Parameters(const std::string& filename) { ReadParam(section, "shadow", &cfg.filter.shadow); ReadParam(section, "main_initial", &cfg.filter.main_initial); ReadParam(section, "shadow_initial", &cfg.filter.shadow_initial); + ReadParam(section, "config_change_duration_blocks", + &cfg.filter.config_change_duration_blocks); + ReadParam(section, "initial_state_seconds", + &cfg.filter.initial_state_seconds); } if (rtc::GetValueFromJsonObject(root, "erle", §ion)) {