AEC3 Tuning changes.
This CL adds tuning to AEC3 for the purpose of reducing the impact of
gain changes in the analog microphone gain.
BUG=chromium:710818, webrtc:6018
Review-Url: https://codereview.webrtc.org/2811283003
Cr-Original-Commit-Position: refs/heads/master@{#17673}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 103ac7e7d9c3548bf43ffa3a24b5e89689695c02
diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc
index 1a9f66f..01c3c44 100644
--- a/modules/audio_processing/aec3/aec_state.cc
+++ b/modules/audio_processing/aec3/aec_state.cc
@@ -72,7 +72,7 @@
}
constexpr int kEchoPathChangeCounterInitial = kNumBlocksPerSecond / 5;
-constexpr int kEchoPathChangeCounterMax = 3 * kNumBlocksPerSecond;
+constexpr int kEchoPathChangeCounterMax = 2 * kNumBlocksPerSecond;
} // namespace
@@ -90,17 +90,19 @@
if (echo_path_variability.AudioPathChanged()) {
blocks_since_last_saturation_ = 0;
active_render_blocks_ = 0;
- echo_path_change_counter_ = kEchoPathChangeCounterMax;
usable_linear_estimate_ = false;
echo_leakage_detected_ = false;
capture_signal_saturation_ = false;
echo_saturation_ = false;
- headset_detected_ = false;
previous_max_sample_ = 0.f;
if (echo_path_variability.delay_change) {
force_zero_gain_counter_ = 0;
force_zero_gain_ = true;
+ echo_path_change_counter_ = kEchoPathChangeCounterMax;
+ }
+ if (echo_path_variability.gain_change) {
+ echo_path_change_counter_ = kEchoPathChangeCounterInitial;
}
}
}
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index af5e94b..816210f 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -10,6 +10,7 @@
#include "webrtc/modules/audio_processing/audio_processing_impl.h"
+#include <math.h>
#include <algorithm>
#include "webrtc/base/checks.h"
@@ -1147,7 +1148,7 @@
if (private_submodules_->echo_canceller3) {
const int new_agc_level = gain_control()->stream_analog_level();
capture_.echo_path_gain_change =
- (capture_.previous_agc_level != new_agc_level);
+ abs(capture_.previous_agc_level - new_agc_level) > 5;
capture_.previous_agc_level = new_agc_level;
private_submodules_->echo_canceller3->AnalyzeCapture(capture_buffer);
}