Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 2016 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 | |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ | |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ | |
| 13 | |
| 14 #include <memory> | |
| 15 #include <vector> | |
| 16 | |
| 17 #include "webrtc/base/constructormagic.h" | |
| 18 #include "webrtc/base/swap_queue.h" | |
| 19 #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.
| |
| 20 #include "webrtc/modules/audio_processing/include/audio_processing.h" | |
| 21 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h" | |
| 22 | |
| 23 namespace webrtc { | |
| 24 | |
| 25 class AudioBuffer; | |
| 26 class EchoDetector; | |
| 27 | |
| 28 class ResidualEchoDetector { | |
| 29 public: | |
| 30 ResidualEchoDetector(rtc::CriticalSection* crit_render, | |
| 31 rtc::CriticalSection* crit_capture); | |
| 32 ~ResidualEchoDetector(); | |
| 33 | |
| 34 void AnalyzeRenderAudio(const AudioBuffer* audio); | |
| 35 void AnalyzeCaptureAudio(const AudioBuffer* audio); | |
| 36 | |
| 37 void Initialize(int sample_rate_hz); | |
| 38 | |
| 39 // Reads render side data that has been queued on the render call. | |
| 40 // Called holding the capture lock. | |
| 41 void ReadQueuedRenderData(); | |
| 42 | |
| 43 float get_echo_likelihood() const; | |
| 44 | |
| 45 private: | |
| 46 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_); | |
| 47 rtc::CriticalSection* const crit_capture_; | |
| 48 | |
| 49 std::vector<float> render_queue_buffer_ GUARDED_BY(crit_render_); | |
| 50 std::vector<float> capture_queue_buffer_ GUARDED_BY(crit_capture_); | |
| 51 | |
| 52 // Lock protection not needed. | |
| 53 std::unique_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>> | |
| 54 render_signal_queue_; | |
| 55 | |
| 56 std::unique_ptr<EchoDetector> detector_; | |
| 57 | |
| 58 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ResidualEchoDetector); | |
| 59 }; | |
| 60 | |
| 61 } // namespace webrtc | |
| 62 | |
| 63 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ | |
| OLD | NEW |