From 9cb06610d23df28a0ead3ec6d5c1511533d88678 Mon Sep 17 00:00:00 2001 From: Sam Zackrisson Date: Fri, 22 Nov 2019 17:03:48 +0100 Subject: [PATCH] Add multi-channel support to AECM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AECM only supports up to two capture channels, this CL extends it to arbitrary channel counts. Bug: webrtc:10859 Change-Id: Id56ca633cd9de706fa1254bfa8153de88de0ef70 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160340 Reviewed-by: Per Ã…hgren Commit-Queue: Sam Zackrisson Cr-Commit-Position: refs/heads/master@{#29880} --- modules/audio_processing/echo_control_mobile_impl.cc | 11 +++++------ modules/audio_processing/echo_control_mobile_impl.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/audio_processing/echo_control_mobile_impl.cc b/modules/audio_processing/echo_control_mobile_impl.cc index 8057e33952..6221aec8bb 100644 --- a/modules/audio_processing/echo_control_mobile_impl.cc +++ b/modules/audio_processing/echo_control_mobile_impl.cc @@ -102,10 +102,7 @@ class EchoControlMobileImpl::Canceller { }; EchoControlMobileImpl::EchoControlMobileImpl() - : routing_mode_(kSpeakerphone), comfort_noise_enabled_(false) { - low_pass_reference_[0].fill(0); - low_pass_reference_[1].fill(0); -} + : routing_mode_(kSpeakerphone), comfort_noise_enabled_(false) {} EchoControlMobileImpl::~EchoControlMobileImpl() {} @@ -257,8 +254,10 @@ bool EchoControlMobileImpl::is_comfort_noise_enabled() const { void EchoControlMobileImpl::Initialize(int sample_rate_hz, size_t num_reverse_channels, size_t num_output_channels) { - low_pass_reference_[0].fill(0); - low_pass_reference_[1].fill(0); + low_pass_reference_.resize(num_output_channels); + for (auto& reference : low_pass_reference_) { + reference.fill(0); + } stream_properties_.reset(new StreamProperties( sample_rate_hz, num_reverse_channels, num_output_channels)); diff --git a/modules/audio_processing/echo_control_mobile_impl.h b/modules/audio_processing/echo_control_mobile_impl.h index 718819d2d4..f12ce2aae7 100644 --- a/modules/audio_processing/echo_control_mobile_impl.h +++ b/modules/audio_processing/echo_control_mobile_impl.h @@ -79,7 +79,7 @@ class EchoControlMobileImpl { std::vector> cancellers_; std::unique_ptr stream_properties_; - std::array, 2> low_pass_reference_; + std::vector> low_pass_reference_; bool reference_copied_ = false; }; } // namespace webrtc