echo_remover.h 2.0 KB

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