nearend_detector.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2019 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_NEAREND_DETECTOR_H_
  11. #define MODULES_AUDIO_PROCESSING_AEC3_NEAREND_DETECTOR_H_
  12. #include <vector>
  13. #include "api/array_view.h"
  14. #include "api/audio/echo_canceller3_config.h"
  15. #include "modules/audio_processing/aec3/aec3_common.h"
  16. namespace webrtc {
  17. // Class for selecting whether the suppressor is in the nearend or echo state.
  18. class NearendDetector {
  19. public:
  20. virtual ~NearendDetector() {}
  21. // Returns whether the current state is the nearend state.
  22. virtual bool IsNearendState() const = 0;
  23. // Updates the state selection based on latest spectral estimates.
  24. virtual void Update(
  25. rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>>
  26. nearend_spectrum,
  27. rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>>
  28. residual_echo_spectrum,
  29. rtc::ArrayView<const std::array<float, kFftLengthBy2Plus1>>
  30. comfort_noise_spectrum,
  31. bool initial_state) = 0;
  32. };
  33. } // namespace webrtc
  34. #endif // MODULES_AUDIO_PROCESSING_AEC3_NEAREND_DETECTOR_H_