OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/base/array_view.h" | 16 #include "webrtc/base/array_view.h" |
17 #include "webrtc/modules/audio_processing/echo_detector/circular_buffer.h" | 17 #include "webrtc/modules/audio_processing/echo_detector/circular_buffer.h" |
18 #include "webrtc/modules/audio_processing/echo_detector/mean_variance_estimator.
h" | 18 #include "webrtc/modules/audio_processing/echo_detector/mean_variance_estimator.
h" |
19 #include "webrtc/modules/audio_processing/echo_detector/moving_max.h" | 19 #include "webrtc/modules/audio_processing/echo_detector/moving_max.h" |
20 #include "webrtc/modules/audio_processing/echo_detector/normalized_covariance_es
timator.h" | 20 #include "webrtc/modules/audio_processing/echo_detector/normalized_covariance_es
timator.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 | 23 |
| 24 class ApmDataDumper; |
24 class AudioBuffer; | 25 class AudioBuffer; |
25 class EchoDetector; | 26 class EchoDetector; |
26 | 27 |
27 class ResidualEchoDetector { | 28 class ResidualEchoDetector { |
28 public: | 29 public: |
29 ResidualEchoDetector(); | 30 ResidualEchoDetector(); |
30 ~ResidualEchoDetector(); | 31 ~ResidualEchoDetector(); |
31 | 32 |
32 // This function should be called while holding the render lock. | 33 // This function should be called while holding the render lock. |
33 void AnalyzeRenderAudio(rtc::ArrayView<const float> render_audio); | 34 void AnalyzeRenderAudio(rtc::ArrayView<const float> render_audio); |
(...skipping 11 matching lines...) Expand all Loading... |
45 std::vector<float>* packed_buffer); | 46 std::vector<float>* packed_buffer); |
46 | 47 |
47 // This function should be called while holding the capture lock. | 48 // This function should be called while holding the capture lock. |
48 float echo_likelihood() const { return echo_likelihood_; } | 49 float echo_likelihood() const { return echo_likelihood_; } |
49 | 50 |
50 float echo_likelihood_recent_max() const { | 51 float echo_likelihood_recent_max() const { |
51 return recent_likelihood_max_.max(); | 52 return recent_likelihood_max_.max(); |
52 } | 53 } |
53 | 54 |
54 private: | 55 private: |
| 56 static int instance_count_; |
| 57 std::unique_ptr<ApmDataDumper> data_dumper_; |
55 // Keep track if the |Process| function has been previously called. | 58 // Keep track if the |Process| function has been previously called. |
56 bool first_process_call_ = true; | 59 bool first_process_call_ = true; |
57 // Buffer for storing the power of incoming farend buffers. This is needed for | 60 // Buffer for storing the power of incoming farend buffers. This is needed for |
58 // cases where calls to BufferFarend and Process are jittery. | 61 // cases where calls to BufferFarend and Process are jittery. |
59 CircularBuffer render_buffer_; | 62 CircularBuffer render_buffer_; |
60 // Count how long ago it was that the size of |render_buffer_| was zero. This | 63 // Count how long ago it was that the size of |render_buffer_| was zero. This |
61 // value is also reset to zero when clock drift is detected and a value from | 64 // value is also reset to zero when clock drift is detected and a value from |
62 // the renderbuffer is discarded, even though the buffer is not actually zero | 65 // the renderbuffer is discarded, even though the buffer is not actually zero |
63 // at that point. This is done to avoid repeatedly removing elements in this | 66 // at that point. This is done to avoid repeatedly removing elements in this |
64 // situation. | 67 // situation. |
(...skipping 15 matching lines...) Expand all Loading... |
80 // Current echo likelihood. | 83 // Current echo likelihood. |
81 float echo_likelihood_ = 0.f; | 84 float echo_likelihood_ = 0.f; |
82 // Reliability of the current likelihood. | 85 // Reliability of the current likelihood. |
83 float reliability_ = 0.f; | 86 float reliability_ = 0.f; |
84 MovingMax recent_likelihood_max_; | 87 MovingMax recent_likelihood_max_; |
85 }; | 88 }; |
86 | 89 |
87 } // namespace webrtc | 90 } // namespace webrtc |
88 | 91 |
89 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ | 92 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_RESIDUAL_ECHO_DETECTOR_H_ |
OLD | NEW |