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