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" | |
hlundin-webrtc
2016/10/14 06:59:18
You are still using critsects below. The way the c
| |
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, | |
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
| |
32 rtc::CriticalSection* crit_capture); | |
33 ~ResidualEchoDetector(); | |
34 | |
35 void AnalyzeRenderAudio(const AudioBuffer* audio); | |
36 void AnalyzeCaptureAudio(AudioBuffer* audio); | |
hlundin-webrtc
2016/10/13 11:45:20
Not const?
ivoc
2016/10/13 13:46:16
Done.
| |
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. | |
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.
| |
42 void ReadQueuedRenderData(); | |
43 | |
44 float get_echo_likelihood(); | |
hlundin-webrtc
2016/10/13 11:45:20
const method.
ivoc
2016/10/13 13:46:16
Done.
| |
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 |