Chromium Code Reviews| Index: webrtc/modules/audio_processing/residual_echo_detector.h |
| diff --git a/webrtc/modules/audio_processing/residual_echo_detector.h b/webrtc/modules/audio_processing/residual_echo_detector.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ec9515bf0a5eb873ec07089605705d7991f1e480 |
| --- /dev/null |
| +++ b/webrtc/modules/audio_processing/residual_echo_detector.h |
| @@ -0,0 +1,64 @@ |
| +/* |
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ |
| +#define WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ |
| + |
| +#include <memory> |
| +#include <vector> |
| + |
| +#include "webrtc/base/constructormagic.h" |
| +#include "webrtc/base/swap_queue.h" |
| +#include "webrtc/modules/audio_processing/include/audio_processing.h" |
| +#include "webrtc/modules/audio_processing/render_queue_item_verifier.h" |
| + |
| +namespace webrtc { |
| + |
| +class AudioBuffer; |
| +class EchoDetector; |
| + |
| +class ResidualEchoDetector { |
| + public: |
| + ResidualEchoDetector(); |
| + ~ResidualEchoDetector(); |
| + |
| + // This function should be called while holding the render lock. |
| + // Returns 0 on success and -1 when the render buffer is full. In that case, |
| + // ReadQueuedRenderData() should be called before calling this function again. |
| + int AnalyzeRenderAudio(const AudioBuffer* audio) const; |
|
hlundin-webrtc
2016/10/14 12:36:21
Make this return true or false instead.
ivoc
2016/10/14 14:45:35
Good idea, done.
|
| + |
| + // This function should be called while holding the capture lock. |
| + void AnalyzeCaptureAudio(const AudioBuffer* audio); |
| + |
| + // This function should be called while holding the capture lock. |
| + void Initialize(int sample_rate_hz); |
| + |
| + // Reads render side data that has been queued on the render call. |
| + // This function should be called while holding the capture lock. |
| + void ReadQueuedRenderData(); |
| + |
| + // This function should be called while holding the capture lock. |
| + float get_echo_likelihood() const; |
| + |
| + private: |
| + mutable std::vector<float> render_queue_buffer_; |
| + std::vector<float> capture_queue_buffer_; |
| + |
| + // Lock protection not needed. |
| + mutable std::unique_ptr< |
| + SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>> |
| + render_signal_queue_; |
| + |
| + std::unique_ptr<EchoDetector> detector_; |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ |