From c522298e03e6a70e85b8f7b90521200a149a9f5d Mon Sep 17 00:00:00 2001 From: Gustaf Ullberg Date: Thu, 5 Oct 2017 10:25:05 +0200 Subject: [PATCH] Added first version of the EchoControl interface, used for AEC abstraction. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:8346 Change-Id: I792a5f8eefb98388de199fea12c017759fdc6c1e Reviewed-on: https://webrtc-review.googlesource.com/6780 Reviewed-by: Per Ã…hgren Commit-Queue: Gustaf Ullberg Cr-Commit-Position: refs/heads/master@{#20174} --- modules/audio_processing/aec3/echo_canceller3.h | 10 +++++----- modules/audio_processing/audio_processing_impl.cc | 2 +- .../audio_processing/include/audio_processing.h | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/modules/audio_processing/aec3/echo_canceller3.h b/modules/audio_processing/aec3/echo_canceller3.h index 742fd1bccf..68250255a9 100644 --- a/modules/audio_processing/aec3/echo_canceller3.h +++ b/modules/audio_processing/aec3/echo_canceller3.h @@ -60,7 +60,7 @@ class Aec3RenderQueueItemVerifier { // // The class is supposed to be used in a non-concurrent manner apart from the // AnalyzeRender call which can be called concurrently with the other methods. -class EchoCanceller3 { +class EchoCanceller3 : public EchoControl { public: // Normal c-tor to use. EchoCanceller3(const AudioProcessing::Config::EchoCanceller3& config, @@ -70,15 +70,15 @@ class EchoCanceller3 { EchoCanceller3(int sample_rate_hz, bool use_highpass_filter, std::unique_ptr block_processor); - ~EchoCanceller3(); + ~EchoCanceller3() override; // Analyzes and stores an internal copy of the split-band domain render // signal. - void AnalyzeRender(AudioBuffer* farend); + void AnalyzeRender(AudioBuffer* farend) override; // Analyzes the full-band domain capture signal to detect signal saturation. - void AnalyzeCapture(AudioBuffer* capture); + void AnalyzeCapture(AudioBuffer* capture) override; // Processes the split-band domain capture signal in order to remove any echo // present in the signal. - void ProcessCapture(AudioBuffer* capture, bool level_change); + void ProcessCapture(AudioBuffer* capture, bool level_change) override; // Signals whether an external detector has detected echo leakage from the // echo canceller. diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc index 99cd082e3e..d2d6668fab 100644 --- a/modules/audio_processing/audio_processing_impl.cc +++ b/modules/audio_processing/audio_processing_impl.cc @@ -302,7 +302,7 @@ struct AudioProcessingImpl::ApmPrivateSubmodules { std::unique_ptr low_cut_filter; std::unique_ptr level_controller; std::unique_ptr residual_echo_detector; - std::unique_ptr echo_canceller3; + std::unique_ptr echo_canceller3; std::unique_ptr capture_post_processor; }; diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h index 21d6018a6f..4d7d15a4b0 100644 --- a/modules/audio_processing/include/audio_processing.h +++ b/modules/audio_processing/include/audio_processing.h @@ -939,6 +939,21 @@ class EchoControlMobile { virtual ~EchoControlMobile() {} }; +// Interface for an acoustic echo cancellation (AEC) submodule. +class EchoControl { + public: + // Analysis (not changing) of the render signal. + virtual void AnalyzeRender(AudioBuffer* render) = 0; + + // Analysis (not changing) of the capture signal. + virtual void AnalyzeCapture(AudioBuffer* capture) = 0; + + // Processes the capture signal in order to remove the echo. + virtual void ProcessCapture(AudioBuffer* capture, bool echo_path_change) = 0; + + virtual ~EchoControl() {} +}; + // The automatic gain control (AGC) component brings the signal to an // appropriate range. This is done by applying a digital gain directly and, in // the analog mode, prescribing an analog gain to be applied at the audio HAL.