Finalization of the first version of EchoCanceller 3
This CL adds the remaining code for the first version of EchoCanceller3.
TBR=aleloi@webrtc.org
BUG=webrtc:6018
Review-Url: https://codereview.webrtc.org/2678423005
Cr-Commit-Position: refs/heads/master@{#16801}
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
index 14d6a26..4c9188f 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
@@ -439,18 +439,11 @@
}
int AudioProcessingImpl::InitializeLocked() {
- int capture_audiobuffer_num_channels;
- if (private_submodules_->echo_canceller3) {
- // TODO(peah): Ensure that the echo canceller can operate on more than one
- // microphone channel.
- RTC_DCHECK(!capture_nonlocked_.beamformer_enabled);
- capture_audiobuffer_num_channels = 1;
- } else {
- capture_audiobuffer_num_channels =
- capture_nonlocked_.beamformer_enabled
- ? formats_.api_format.input_stream().num_channels()
- : formats_.api_format.output_stream().num_channels();
- }
+ const int capture_audiobuffer_num_channels =
+ capture_nonlocked_.beamformer_enabled
+ ? formats_.api_format.input_stream().num_channels()
+ : formats_.api_format.output_stream().num_channels();
+
const int render_audiobuffer_num_output_frames =
formats_.api_format.reverse_output_stream().num_frames() == 0
? formats_.render_processing_format.num_frames()
@@ -576,9 +569,7 @@
submodule_states_.RenderMultiBandSubModulesActive());
// TODO(aluebs): Remove this restriction once we figure out why the 3-band
// splitting filter degrades the AEC performance.
- // TODO(peah): Verify that the band splitting is needed for the AEC3.
- if (render_processing_rate > kSampleRate32kHz &&
- !capture_nonlocked_.echo_canceller3_enabled) {
+ if (render_processing_rate > kSampleRate32kHz) {
render_processing_rate = submodule_states_.RenderMultiBandProcessingActive()
? kSampleRate32kHz
: kSampleRate16kHz;
@@ -1162,6 +1153,14 @@
capture_buffer->SplitIntoFrequencyBands();
}
+ if (private_submodules_->echo_canceller3) {
+ // Force down-mixing of the number of channels after the detection of
+ // capture signal saturation.
+ // TODO(peah): Look into ensuring that this kind of tampering with the
+ // AudioBuffer functionality should not be needed.
+ capture_buffer->set_num_channels(1);
+ }
+
if (capture_nonlocked_.beamformer_enabled) {
private_submodules_->beamformer->AnalyzeChunk(
*capture_buffer->split_data_f());