peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_ |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 13 | |
| 14 | #include <vector> |
| 15 | |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 16 | #include "absl/types/optional.h" |
Gustaf Ullberg | 3646f97 | 2018-02-14 15:19:04 +0100 | [diff] [blame] | 17 | #include "api/audio/echo_canceller3_config.h" |
Gustaf Ullberg | fd4ce50 | 2018-02-15 10:09:09 +0100 | [diff] [blame] | 18 | #include "api/audio/echo_control.h" |
Per Åhgren | 3ab308f | 2018-02-21 08:46:03 +0100 | [diff] [blame] | 19 | #include "modules/audio_processing/aec3/delay_estimate.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 20 | #include "modules/audio_processing/aec3/echo_path_variability.h" |
| 21 | #include "modules/audio_processing/aec3/render_buffer.h" |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | // Class for removing the echo from the capture signal. |
| 26 | class EchoRemover { |
| 27 | public: |
Gustaf Ullberg | bd83b91 | 2017-10-18 12:32:42 +0200 | [diff] [blame] | 28 | static EchoRemover* Create(const EchoCanceller3Config& config, |
| 29 | int sample_rate_hz); |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 30 | virtual ~EchoRemover() = default; |
| 31 | |
Gustaf Ullberg | 332150d | 2017-11-22 14:17:39 +0100 | [diff] [blame] | 32 | // Get current metrics. |
| 33 | virtual void GetMetrics(EchoControl::Metrics* metrics) const = 0; |
| 34 | |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 35 | // Removes the echo from a block of samples from the capture signal. The |
| 36 | // supplied render signal is assumed to be pre-aligned with the capture |
| 37 | // signal. |
peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 38 | virtual void ProcessCapture( |
Per Åhgren | 88cf050 | 2018-07-16 17:08:41 +0200 | [diff] [blame] | 39 | EchoPathVariability echo_path_variability, |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 40 | bool capture_signal_saturation, |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 41 | const absl::optional<DelayEstimate>& external_delay, |
Per Åhgren | c59a576 | 2017-12-11 21:34:19 +0100 | [diff] [blame] | 42 | RenderBuffer* render_buffer, |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 43 | std::vector<std::vector<float>>* capture) = 0; |
| 44 | |
Per Åhgren | 5c532d3 | 2018-03-22 00:29:25 +0100 | [diff] [blame] | 45 | // Returns the internal delay estimate in blocks. |
Danil Chapovalov | db9f7ab | 2018-06-19 10:50:11 +0200 | [diff] [blame] | 46 | virtual absl::optional<int> Delay() const = 0; |
Per Åhgren | 5c532d3 | 2018-03-22 00:29:25 +0100 | [diff] [blame] | 47 | |
peah | 69221db | 2017-01-27 03:28:19 -0800 | [diff] [blame] | 48 | // Updates the status on whether echo leakage is detected in the output of the |
| 49 | // echo remover. |
| 50 | virtual void UpdateEchoLeakageStatus(bool leakage_detected) = 0; |
| 51 | }; |
| 52 | |
| 53 | } // namespace webrtc |
| 54 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 55 | #endif // MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_ |