EchoControl factory injectable in AudioProcessing.

This CL enables a factory method creating acoustic echo cancellers
that inherit EchoControl to be injected into the audio processing
module. AudioProcessing will call the factory method to create an
instance of the EchoControl subclass when needed. In the event of
sample rate changes, AudioProcessing will recreate the object using
the factory method.

Bug: webrtc:8346
Change-Id: I0c508b4d4cdb35569864cefaa0e3aea2555cc9b9
Reviewed-on: https://webrtc-review.googlesource.com/7742
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Ã…hgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20251}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 54aed34..2cbea50 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -23,6 +23,7 @@
 #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"
@@ -43,6 +44,7 @@
 
 class EchoCancellation;
 class EchoControlMobile;
+class EchoControl;
 class GainControl;
 class HighPassFilter;
 class LevelEstimator;
@@ -376,10 +378,15 @@
   RTC_DEPRECATED
   static AudioProcessing* Create(const webrtc::Config& config,
                                  NonlinearBeamformer* beamformer);
+  static AudioProcessing* Create(
+      const webrtc::Config& config,
+      std::unique_ptr<PostProcessing> capture_post_processor,
+      NonlinearBeamformer* beamformer);
   // Allows passing in optional user-defined processing modules.
   static AudioProcessing* Create(
       const webrtc::Config& config,
       std::unique_ptr<PostProcessing> capture_post_processor,
+      rtc::Callback1<EchoControl*, int> echo_control_factory,
       NonlinearBeamformer* beamformer);
   ~AudioProcessing() override {}