From 90e3fbdd37005ebaecf688cbcf7ad0054334254d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Wed, 16 May 2018 15:25:04 +0200 Subject: [PATCH] Activating the AEC3 audibility improvements functionality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL turns on the previously implemented AEC3 audibility improvements, which before has been off by default. Bug: webrtc:9193,chromium:836790 Change-Id: Ibcd057ba5dd002718d62fd83db33d01d9563b8ea Reviewed-on: https://webrtc-review.googlesource.com/77123 Reviewed-by: Gustaf Ullberg Reviewed-by: Jesus de Vicente Pena Commit-Queue: Per Ã…hgren Cr-Commit-Position: refs/heads/master@{#23265} --- api/audio/echo_canceller3_config.h | 2 +- modules/audio_processing/aec3/aec_state.cc | 12 ++++++++++-- modules/audio_processing/aec3/aec_state.h | 7 +++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/api/audio/echo_canceller3_config.h b/api/audio/echo_canceller3_config.h index 592dce4550..51feccb700 100644 --- a/api/audio/echo_canceller3_config.h +++ b/api/audio/echo_canceller3_config.h @@ -97,7 +97,7 @@ struct EchoCanceller3Config { float audibility_threshold_lf = 10; float audibility_threshold_mf = 10; float audibility_threshold_hf = 10; - bool use_stationary_properties = false; + bool use_stationary_properties = true; } echo_audibility; struct RenderLevels { diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc index 2222b18452..8f3708f666 100644 --- a/modules/audio_processing/aec3/aec_state.cc +++ b/modules/audio_processing/aec3/aec_state.cc @@ -28,6 +28,11 @@ bool EnableTransparentMode() { return !field_trial::IsEnabled("WebRTC-Aec3TransparentModeKillSwitch"); } +bool EnableStationaryRenderImprovements() { + return !field_trial::IsEnabled( + "WebRTC-Aec3StationaryRenderImprovementsKillSwitch"); +} + float ComputeGainRampupIncrease(const EchoCanceller3Config& config) { const auto& c = config.echo_removal_control.gain_rampup; return powf(1.f / c.first_non_zero_gain, 1.f / c.non_zero_gain_blocks); @@ -43,9 +48,12 @@ int AecState::instance_count_ = 0; AecState::AecState(const EchoCanceller3Config& config) : data_dumper_( new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), - allow_transparent_mode_(EnableTransparentMode()), - erle_estimator_(config.erle.min, config.erle.max_l, config.erle.max_h), config_(config), + allow_transparent_mode_(EnableTransparentMode()), + use_stationary_properties_( + EnableStationaryRenderImprovements() && + config_.echo_audibility.use_stationary_properties), + erle_estimator_(config.erle.min, config.erle.max_l, config.erle.max_h), max_render_(config_.filter.main.length_blocks, 0.f), reverb_decay_(fabsf(config_.ep_strength.default_len)), gain_rampup_increase_(ComputeGainRampupIncrease(config_)), diff --git a/modules/audio_processing/aec3/aec_state.h b/modules/audio_processing/aec3/aec_state.h index 7d5fe43338..39314ff645 100644 --- a/modules/audio_processing/aec3/aec_state.h +++ b/modules/audio_processing/aec3/aec_state.h @@ -62,9 +62,7 @@ class AecState { // Returns whether the stationary properties of the signals are used in the // aec. - bool UseStationaryProperties() const { - return config_.echo_audibility.use_stationary_properties; - } + bool UseStationaryProperties() const { return use_stationary_properties_; } // Returns the ERLE. const std::array& Erle() const { @@ -142,7 +140,9 @@ class AecState { static int instance_count_; std::unique_ptr data_dumper_; + const EchoCanceller3Config config_; const bool allow_transparent_mode_; + const bool use_stationary_properties_; ErlEstimator erl_estimator_; ErleEstimator erle_estimator_; size_t capture_block_counter_ = 0; @@ -166,7 +166,6 @@ class AecState { bool found_end_of_reverb_decay_ = false; bool main_filter_is_adapting_ = true; std::array block_energies_; - const EchoCanceller3Config config_; std::vector max_render_; float reverb_decay_ = fabsf(config_.ep_strength.default_len); bool filter_has_had_time_to_converge_ = false;