Add information about microphone gain changes to AEC3
Changes in the microphone gain are effecting the AEC in the sense
that each change in the microphone gain is a change in the echo
path seen by the AEC. This CL utilizes the ability of AEC3 to
leverage information about known changes in the analog microphone
gain.
BUG=webrtc:6018
Review-Url: https://codereview.webrtc.org/2808073002
Cr-Commit-Position: refs/heads/master@{#17625}
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
index 636d6ca..af5e94b 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
@@ -1145,6 +1145,10 @@
}
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);
+ capture_.previous_agc_level = new_agc_level;
private_submodules_->echo_canceller3->AnalyzeCapture(capture_buffer);
}
@@ -1193,7 +1197,8 @@
}
if (private_submodules_->echo_canceller3) {
- private_submodules_->echo_canceller3->ProcessCapture(capture_buffer, false);
+ private_submodules_->echo_canceller3->ProcessCapture(
+ capture_buffer, capture_.echo_path_gain_change);
} else {
RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessCaptureAudio(
capture_buffer, stream_delay_ms()));
@@ -1993,7 +1998,9 @@
array_geometry(array_geometry),
target_direction(target_direction),
capture_processing_format(kSampleRate16kHz),
- split_rate(kSampleRate16kHz) {}
+ split_rate(kSampleRate16kHz),
+ previous_agc_level(0),
+ echo_path_gain_change(false) {}
AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;