Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: webrtc/modules/audio_processing/residual_echo_detector.h

Issue 2405403003: Add empty residual echo detector. (Closed)
Patch Set: Moved responsibility for proper locking to APM. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/modules/audio_processing/include/audio_processing.h"
20 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h"
21
22 namespace webrtc {
23
24 class AudioBuffer;
25 class EchoDetector;
26
27 class ResidualEchoDetector {
28 public:
29 ResidualEchoDetector();
30 ~ResidualEchoDetector();
31
32 // This function should be called while holding the render lock.
33 // Returns 0 on success and -1 when the render buffer is full. In that case,
34 // ReadQueuedRenderData() should be called before calling this function again.
35 int AnalyzeRenderAudio(const AudioBuffer* audio) const;
hlundin-webrtc 2016/10/14 12:36:21 Make this return true or false instead.
ivoc 2016/10/14 14:45:35 Good idea, done.
36
37 // This function should be called while holding the capture lock.
38 void AnalyzeCaptureAudio(const AudioBuffer* audio);
39
40 // This function should be called while holding the capture lock.
41 void Initialize(int sample_rate_hz);
42
43 // Reads render side data that has been queued on the render call.
44 // This function should be called while holding the capture lock.
45 void ReadQueuedRenderData();
46
47 // This function should be called while holding the capture lock.
48 float get_echo_likelihood() const;
49
50 private:
51 mutable std::vector<float> render_queue_buffer_;
52 std::vector<float> capture_queue_buffer_;
53
54 // Lock protection not needed.
55 mutable std::unique_ptr<
56 SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>>
57 render_signal_queue_;
58
59 std::unique_ptr<EchoDetector> detector_;
60 };
61
62 } // namespace webrtc
63
64 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698