1 /*
2  *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_
12 #define MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_
13 
14 #include <vector>
15 
16 #include "api/optional.h"
17 #include "modules/audio_processing/aec3/echo_path_variability.h"
18 #include "modules/audio_processing/aec3/render_buffer.h"
19 #include "modules/audio_processing/include/audio_processing.h"
20 
21 namespace webrtc {
22 
23 // Class for removing the echo from the capture signal.
24 class EchoRemover {
25  public:
26   static EchoRemover* Create(const EchoCanceller3Config& config,
27                              int sample_rate_hz);
28   virtual ~EchoRemover() = default;
29 
30   // Get current metrics.
31   virtual void GetMetrics(EchoControl::Metrics* metrics) const = 0;
32 
33   // Removes the echo from a block of samples from the capture signal. The
34   // supplied render signal is assumed to be pre-aligned with the capture
35   // signal.
36   virtual void ProcessCapture(
37       const rtc::Optional<size_t>& echo_path_delay_samples,
38       const EchoPathVariability& echo_path_variability,
39       bool capture_signal_saturation,
40       const RenderBuffer& render_buffer,
41       std::vector<std::vector<float>>* capture) = 0;
42 
43   // Updates the status on whether echo leakage is detected in the output of the
44   // echo remover.
45   virtual void UpdateEchoLeakageStatus(bool leakage_detected) = 0;
46 };
47 
48 }  // namespace webrtc
49 
50 #endif  // MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_
51