AEC3: Adding explicit handling of microphone gain changes
This CL re-activates the explicit handling of microphone
gain changes in the AEC3 code. The implementation is done
beneath a kill-switch so that when that switch is active
the changes in this CL are bitexact.
Bug: webrtc:9526,chromium:863826
Change-Id: I58e93d8bc0bce7bec91e102de9891ad48ebc55d8
Reviewed-on: https://webrtc-review.googlesource.com/88620
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23986}
diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc
index e87d2cf..7e5955a 100644
--- a/modules/audio_processing/audio_processing_impl.cc
+++ b/modules/audio_processing/audio_processing_impl.cc
@@ -1198,9 +1198,13 @@
}
if (private_submodules_->echo_controller) {
- // TODO(peah): Reactivate analogue AGC gain detection once the analogue AGC
- // issues have been addressed.
- capture_.echo_path_gain_change = false;
+ // Detect and flag any change in the analog gain.
+ int analog_mic_level = gain_control()->stream_analog_level();
+ capture_.echo_path_gain_change =
+ capture_.prev_analog_mic_level != analog_mic_level &&
+ capture_.prev_analog_mic_level != -1;
+ capture_.prev_analog_mic_level = analog_mic_level;
+
private_submodules_->echo_controller->AnalyzeCapture(capture_buffer);
}
@@ -2049,7 +2053,8 @@
transient_suppressor_enabled(transient_suppressor_enabled),
capture_processing_format(kSampleRate16kHz),
split_rate(kSampleRate16kHz),
- echo_path_gain_change(false) {}
+ echo_path_gain_change(false),
+ prev_analog_mic_level(-1) {}
AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;