blob: c8f73b8bac550ab034588ed35499453bb10c4f57 [file] [log] [blame]
Gustaf Ullberg8e467df2018-02-05 14:39:38 +01001/*
2 * Copyright (c) 2018 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
Gustaf Ullbergfd4ce502018-02-15 10:09:09 +010011#ifndef API_AUDIO_ECHO_CONTROL_H_
12#define API_AUDIO_ECHO_CONTROL_H_
Gustaf Ullberg8e467df2018-02-05 14:39:38 +010013
14#include <memory>
15
16namespace webrtc {
17
18class AudioBuffer;
19
20// Interface for an acoustic echo cancellation (AEC) submodule.
21class EchoControl {
22 public:
23 // Analysis (not changing) of the render signal.
24 virtual void AnalyzeRender(AudioBuffer* render) = 0;
25
26 // Analysis (not changing) of the capture signal.
27 virtual void AnalyzeCapture(AudioBuffer* capture) = 0;
28
29 // Processes the capture signal in order to remove the echo.
30 virtual void ProcessCapture(AudioBuffer* capture, bool echo_path_change) = 0;
31
32 struct Metrics {
33 double echo_return_loss;
34 double echo_return_loss_enhancement;
35 int delay_ms;
36 };
37
38 // Collect current metrics from the echo controller.
39 virtual Metrics GetMetrics() const = 0;
40
Per Ã…hgrend0fa8202018-04-18 09:35:13 +020041 // Provides an optional external estimate of the audio buffer delay.
42 virtual void SetAudioBufferDelay(size_t delay_ms) = 0;
43
Gustaf Ullberg8675eee2019-10-09 13:34:36 +020044 // Returns wheter the signal is altered.
45 virtual bool ActiveProcessing() const = 0;
46
Gustaf Ullberg8e467df2018-02-05 14:39:38 +010047 virtual ~EchoControl() {}
48};
49
50// Interface for a factory that creates EchoControllers.
51class EchoControlFactory {
52 public:
53 virtual std::unique_ptr<EchoControl> Create(int sample_rate_hz) = 0;
54 virtual ~EchoControlFactory() = default;
55};
56} // namespace webrtc
57
Gustaf Ullbergfd4ce502018-02-15 10:09:09 +010058#endif // API_AUDIO_ECHO_CONTROL_H_