blob: cc8dae9c17924fe27cb188b164b8aebaffa9ddb8 [file] [log] [blame]
peah69221db2017-01-27 03:28:19 -08001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_
12#define MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_
peah69221db2017-01-27 03:28:19 -080013
14#include <vector>
15
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020016#include "absl/types/optional.h"
Gustaf Ullberg3646f972018-02-14 15:19:04 +010017#include "api/audio/echo_canceller3_config.h"
Gustaf Ullbergfd4ce502018-02-15 10:09:09 +010018#include "api/audio/echo_control.h"
Per Åhgren3ab308f2018-02-21 08:46:03 +010019#include "modules/audio_processing/aec3/delay_estimate.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "modules/audio_processing/aec3/echo_path_variability.h"
21#include "modules/audio_processing/aec3/render_buffer.h"
peah69221db2017-01-27 03:28:19 -080022
23namespace webrtc {
24
25// Class for removing the echo from the capture signal.
26class EchoRemover {
27 public:
Gustaf Ullbergbd83b912017-10-18 12:32:42 +020028 static EchoRemover* Create(const EchoCanceller3Config& config,
29 int sample_rate_hz);
peah69221db2017-01-27 03:28:19 -080030 virtual ~EchoRemover() = default;
31
Gustaf Ullberg332150d2017-11-22 14:17:39 +010032 // Get current metrics.
33 virtual void GetMetrics(EchoControl::Metrics* metrics) const = 0;
34
peah69221db2017-01-27 03:28:19 -080035 // 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.
peahcf02cf12017-04-05 14:18:07 -070038 virtual void ProcessCapture(
Per Åhgren88cf0502018-07-16 17:08:41 +020039 EchoPathVariability echo_path_variability,
peah69221db2017-01-27 03:28:19 -080040 bool capture_signal_saturation,
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020041 const absl::optional<DelayEstimate>& external_delay,
Per Åhgrenc59a5762017-12-11 21:34:19 +010042 RenderBuffer* render_buffer,
peah69221db2017-01-27 03:28:19 -080043 std::vector<std::vector<float>>* capture) = 0;
44
Per Åhgren5c532d32018-03-22 00:29:25 +010045 // Returns the internal delay estimate in blocks.
Danil Chapovalovdb9f7ab2018-06-19 10:50:11 +020046 virtual absl::optional<int> Delay() const = 0;
Per Åhgren5c532d32018-03-22 00:29:25 +010047
peah69221db2017-01-27 03:28:19 -080048 // 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 Bonadei92ea95e2017-09-15 06:47:31 +020055#endif // MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_