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..c8fe9622c699d19eefb13a0a1b67bad1276395dd |
| --- /dev/null |
| +++ b/webrtc/modules/audio_processing/residual_echo_detector.h |
| @@ -0,0 +1,63 @@ |
| +/* |
| + * 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/base/thread_checker.h" |
|
hlundin-webrtc
2016/10/14 06:59:18
You didn't add any thread checker, did you?
ivoc
2016/10/14 09:53:19
Good point.
|
| +#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(rtc::CriticalSection* crit_render, |
| + rtc::CriticalSection* crit_capture); |
| + ~ResidualEchoDetector(); |
| + |
| + void AnalyzeRenderAudio(const AudioBuffer* audio); |
| + void AnalyzeCaptureAudio(const AudioBuffer* audio); |
| + |
| + void Initialize(int sample_rate_hz); |
| + |
| + // Reads render side data that has been queued on the render call. |
| + // Called holding the capture lock. |
| + void ReadQueuedRenderData(); |
| + |
| + float get_echo_likelihood() const; |
| + |
| + private: |
| + rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_); |
| + rtc::CriticalSection* const crit_capture_; |
| + |
| + std::vector<float> render_queue_buffer_ GUARDED_BY(crit_render_); |
| + std::vector<float> capture_queue_buffer_ GUARDED_BY(crit_capture_); |
| + |
| + // Lock protection not needed. |
| + std::unique_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>> |
| + render_signal_queue_; |
| + |
| + std::unique_ptr<EchoDetector> detector_; |
| + |
| + RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ResidualEchoDetector); |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ |