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..d87e77f850737a600111d4fb3343ce358751e341 |
| --- /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/criticalsection.h" |
|
hlundin-webrtc
2016/10/14 06:59:18
You are still using critsects below. The way the c
|
| +#include "webrtc/base/optional.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(rtc::CriticalSection* crit_render, |
|
hlundin-webrtc
2016/10/13 11:45:20
I don't think you need the shared locks with the r
ivoc
2016/10/13 13:46:16
I'm not that familiar with the locking scheme in t
hlundin-webrtc
2016/10/14 06:59:18
I think local locks is preferred, since they only
peah-webrtc
2016/10/14 07:12:29
I agree with hlundin@ that no locks should be requ
ivoc
2016/10/14 09:53:18
I have now removed all locks from this class and m
|
| + rtc::CriticalSection* crit_capture); |
| + ~ResidualEchoDetector(); |
| + |
| + void AnalyzeRenderAudio(const AudioBuffer* audio); |
| + void AnalyzeCaptureAudio(AudioBuffer* audio); |
|
hlundin-webrtc
2016/10/13 11:45:20
Not const?
ivoc
2016/10/13 13:46:16
Done.
|
| + |
| + void Initialize(int sample_rate_hz); |
| + |
| + // Reads render side data that has been queued on the render call. |
| + // Called holding the capture lock. |
|
hlundin-webrtc
2016/10/13 11:45:20
Document this locking assumption with EXCLUSIVE_LO
ivoc
2016/10/13 13:46:16
Adding EXCLUSIVE_LOCKS_REQUIRED here does not work
hlundin-webrtc
2016/10/14 06:59:18
Acknowledged.
|
| + void ReadQueuedRenderData(); |
| + |
| + float get_echo_likelihood(); |
|
hlundin-webrtc
2016/10/13 11:45:20
const method.
ivoc
2016/10/13 13:46:16
Done.
|
| + |
| + 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_ |