Add multi-channel support to AECM

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 <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29880}
This commit is contained in:
Sam Zackrisson
2019-11-22 17:03:48 +01:00
committed by Commit Bot
parent c4f865413a
commit 9cb06610d2
2 changed files with 6 additions and 7 deletions

View File

@ -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));

View File

@ -79,7 +79,7 @@ class EchoControlMobileImpl {
std::vector<std::unique_ptr<Canceller>> cancellers_;
std::unique_ptr<StreamProperties> stream_properties_;
std::array<std::array<int16_t, 160>, 2> low_pass_reference_;
std::vector<std::array<int16_t, 160>> low_pass_reference_;
bool reference_copied_ = false;
};
} // namespace webrtc