Added EchoControlFactory interface.

The factory for EchoControl is changed from an rtc::Callback1 to an
interface. This avoids using rtc::Callback1 outside of WebRTC.
This also makes the EchoControl factory more similar to other
factories in the code base.

Bug: webrtc:8345
Change-Id: Ie61b9416ed771f8c756326736d17e339eb768469
Reviewed-on: https://webrtc-review.googlesource.com/8900
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20272}
This commit is contained in:
Gustaf Ullberg
2017-10-12 15:13:17 +02:00
committed by Commit Bot
parent 6f09ae20bd
commit 002ef28272
6 changed files with 65 additions and 30 deletions

View File

@ -23,7 +23,6 @@
#include "modules/audio_processing/beamformer/array_util.h"
#include "modules/audio_processing/include/config.h"
#include "rtc_base/arraysize.h"
#include "rtc_base/callback.h"
#include "rtc_base/deprecation.h"
#include "rtc_base/platform_file.h"
#include "rtc_base/refcount.h"
@ -44,7 +43,7 @@ class ProcessingConfig;
class EchoCancellation;
class EchoControlMobile;
class EchoControl;
class EchoControlFactory;
class GainControl;
class HighPassFilter;
class LevelEstimator;
@ -386,7 +385,7 @@ class AudioProcessing : public rtc::RefCountInterface {
static AudioProcessing* Create(
const webrtc::Config& config,
std::unique_ptr<PostProcessing> capture_post_processor,
rtc::Callback1<EchoControl*, int> echo_control_factory,
std::unique_ptr<EchoControlFactory> echo_control_factory,
NonlinearBeamformer* beamformer);
~AudioProcessing() override {}
@ -971,6 +970,13 @@ class EchoControl {
virtual ~EchoControl() {}
};
// Interface for a factory that creates EchoControllers.
class EchoControlFactory {
public:
virtual std::unique_ptr<EchoControl> Create(int sample_rate_hz) = 0;
virtual ~EchoControlFactory() = default;
};
// 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.