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 "absl/types/optional.h" 17 #include "api/audio/echo_canceller3_config.h" 18 #include "api/audio/echo_control.h" 19 #include "modules/audio_processing/aec3/delay_estimate.h" 20 #include "modules/audio_processing/aec3/echo_path_variability.h" 21 #include "modules/audio_processing/aec3/render_buffer.h" 22 23 namespace webrtc { 24 25 // Class for removing the echo from the capture signal. 26 class EchoRemover { 27 public: 28 static EchoRemover* Create(const EchoCanceller3Config& config, 29 int sample_rate_hz, 30 size_t num_render_channels, 31 size_t num_capture_channels); 32 virtual ~EchoRemover() = default; 33 34 // Get current metrics. 35 virtual void GetMetrics(EchoControl::Metrics* metrics) const = 0; 36 37 // Removes the echo from a block of samples from the capture signal. The 38 // supplied render signal is assumed to be pre-aligned with the capture 39 // signal. 40 virtual void ProcessCapture( 41 EchoPathVariability echo_path_variability, 42 bool capture_signal_saturation, 43 const absl::optional<DelayEstimate>& external_delay, 44 RenderBuffer* render_buffer, 45 std::vector<std::vector<std::vector<float>>>* linear_output, 46 std::vector<std::vector<std::vector<float>>>* capture) = 0; 47 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 55 #endif // MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_ 56