echo_remover.h (2500B)
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 <cstddef> 15 #include <memory> 16 #include <optional> 17 18 #include "api/audio/echo_canceller3_config.h" 19 #include "api/audio/echo_control.h" 20 #include "api/audio/neural_residual_echo_estimator.h" 21 #include "api/environment/environment.h" 22 #include "modules/audio_processing/aec3/block.h" 23 #include "modules/audio_processing/aec3/delay_estimate.h" 24 #include "modules/audio_processing/aec3/echo_path_variability.h" 25 #include "modules/audio_processing/aec3/render_buffer.h" 26 27 namespace webrtc { 28 29 // Class for removing the echo from the capture signal. 30 class EchoRemover { 31 public: 32 static std::unique_ptr<EchoRemover> Create( 33 const Environment& env, 34 const EchoCanceller3Config& config, 35 int sample_rate_hz, 36 size_t num_render_channels, 37 size_t num_capture_channels, 38 NeuralResidualEchoEstimator* neural_residual_echo_estimator); 39 virtual ~EchoRemover() = default; 40 41 // Get current metrics. 42 virtual void GetMetrics(EchoControl::Metrics* metrics) const = 0; 43 44 // Removes the echo from a block of samples from the capture signal. The 45 // supplied render signal is assumed to be pre-aligned with the capture 46 // signal. 47 virtual void ProcessCapture( 48 EchoPathVariability echo_path_variability, 49 bool capture_signal_saturation, 50 const std::optional<DelayEstimate>& external_delay, 51 RenderBuffer* render_buffer, 52 Block* linear_output, 53 Block* capture) = 0; 54 55 // Updates the status on whether echo leakage is detected in the output of the 56 // echo remover. 57 virtual void UpdateEchoLeakageStatus(bool leakage_detected) = 0; 58 59 // Specifies whether the capture output will be used. The purpose of this is 60 // to allow the echo remover to deactivate some of the processing when the 61 // resulting output is anyway not used, for instance when the endpoint is 62 // muted. 63 virtual void SetCaptureOutputUsage(bool capture_output_used) = 0; 64 }; 65 66 } // namespace webrtc 67 68 #endif // MODULES_AUDIO_PROCESSING_AEC3_ECHO_REMOVER_H_