You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.7 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2018 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 API_AUDIO_ECHO_CONTROL_H_
  11. #define API_AUDIO_ECHO_CONTROL_H_
  12. #include <memory>
  13. namespace webrtc {
  14. class AudioBuffer;
  15. // Interface for an acoustic echo cancellation (AEC) submodule.
  16. class EchoControl {
  17. public:
  18. // Analysis (not changing) of the render signal.
  19. virtual void AnalyzeRender(AudioBuffer* render) = 0;
  20. // Analysis (not changing) of the capture signal.
  21. virtual void AnalyzeCapture(AudioBuffer* capture) = 0;
  22. // Processes the capture signal in order to remove the echo.
  23. virtual void ProcessCapture(AudioBuffer* capture, bool echo_path_change) = 0;
  24. struct Metrics {
  25. double echo_return_loss;
  26. double echo_return_loss_enhancement;
  27. int delay_ms;
  28. };
  29. // Collect current metrics from the echo controller.
  30. virtual Metrics GetMetrics() const = 0;
  31. // Provides an optional external estimate of the audio buffer delay.
  32. virtual void SetAudioBufferDelay(size_t delay_ms) = 0;
  33. // Returns wheter the signal is altered.
  34. virtual bool ActiveProcessing() const = 0;
  35. virtual ~EchoControl() {}
  36. };
  37. // Interface for a factory that creates EchoControllers.
  38. class EchoControlFactory {
  39. public:
  40. virtual std::unique_ptr<EchoControl> Create(int sample_rate_hz) = 0;
  41. virtual ~EchoControlFactory() = default;
  42. };
  43. } // namespace webrtc
  44. #endif // API_AUDIO_ECHO_CONTROL_H_