OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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_AUDIO_PROCESSING_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
19 #include "webrtc/base/thread_annotations.h" | 19 #include "webrtc/base/thread_annotations.h" |
| 20 #include "webrtc/base/thread_checker.h" |
20 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 21 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
21 | 22 |
22 namespace webrtc { | 23 namespace webrtc { |
23 | 24 |
24 class AgcManagerDirect; | 25 class AgcManagerDirect; |
25 class AudioBuffer; | 26 class AudioBuffer; |
26 class AudioConverter; | 27 class AudioConverter; |
27 | 28 |
28 template<typename T> | 29 template<typename T> |
29 class Beamformer; | 30 class Beamformer; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 NoiseSuppression* noise_suppression() const override; | 116 NoiseSuppression* noise_suppression() const override; |
116 VoiceDetection* voice_detection() const override; | 117 VoiceDetection* voice_detection() const override; |
117 | 118 |
118 protected: | 119 protected: |
119 // Overridden in a mock. | 120 // Overridden in a mock. |
120 virtual int InitializeLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 121 virtual int InitializeLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
121 | 122 |
122 private: | 123 private: |
123 int InitializeLocked(const ProcessingConfig& config) | 124 int InitializeLocked(const ProcessingConfig& config) |
124 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 125 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 126 int MaybeInitializeLockedRender(const ProcessingConfig& config) |
| 127 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 128 int MaybeInitializeLockedCapture(const ProcessingConfig& config) |
| 129 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
125 int MaybeInitializeLocked(const ProcessingConfig& config) | 130 int MaybeInitializeLocked(const ProcessingConfig& config) |
126 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 131 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
127 // TODO(ekm): Remove once all clients updated to new interface. | 132 // TODO(ekm): Remove once all clients updated to new interface. |
128 int AnalyzeReverseStream(const float* const* src, | 133 int AnalyzeReverseStream(const float* const* src, |
129 const StreamConfig& input_config, | 134 const StreamConfig& input_config, |
130 const StreamConfig& output_config); | 135 const StreamConfig& output_config); |
131 int ProcessStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 136 int ProcessStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
132 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 137 int ProcessReverseStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
133 | 138 |
134 bool is_data_processed() const; | 139 bool is_data_processed() const; |
135 bool output_copy_needed(bool is_data_processed) const; | 140 bool output_copy_needed(bool is_data_processed) const; |
136 bool synthesis_needed(bool is_data_processed) const; | 141 bool synthesis_needed(bool is_data_processed) const; |
137 bool analysis_needed(bool is_data_processed) const; | 142 bool analysis_needed(bool is_data_processed) const; |
138 bool is_rev_processed() const; | 143 bool is_rev_processed() const; |
139 bool rev_conversion_needed() const; | 144 bool rev_conversion_needed() const; |
| 145 // TODO(peah): Add EXCLUSIVE_LOCKS_REQUIRED for the method below. |
| 146 bool render_check_rev_conversion_needed() const; |
140 void InitializeExperimentalAgc() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 147 void InitializeExperimentalAgc() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
141 void InitializeTransient() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 148 void InitializeTransient() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
142 void InitializeBeamformer() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 149 void InitializeBeamformer() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
143 void InitializeIntelligibility() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 150 void InitializeIntelligibility() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
144 void MaybeUpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 151 void MaybeUpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
145 | 152 |
146 EchoCancellationImpl* echo_cancellation_; | 153 EchoCancellationImpl* echo_cancellation_; |
147 EchoControlMobileImpl* echo_control_mobile_; | 154 EchoControlMobileImpl* echo_control_mobile_; |
148 GainControlImpl* gain_control_; | 155 GainControlImpl* gain_control_; |
149 HighPassFilterImpl* high_pass_filter_; | 156 HighPassFilterImpl* high_pass_filter_; |
150 LevelEstimatorImpl* level_estimator_; | 157 LevelEstimatorImpl* level_estimator_; |
151 NoiseSuppressionImpl* noise_suppression_; | 158 NoiseSuppressionImpl* noise_suppression_; |
152 VoiceDetectionImpl* voice_detection_; | 159 VoiceDetectionImpl* voice_detection_; |
153 rtc::scoped_ptr<GainControlForNewAgc> gain_control_for_new_agc_; | 160 rtc::scoped_ptr<GainControlForNewAgc> gain_control_for_new_agc_; |
154 | 161 |
155 std::list<ProcessingComponent*> component_list_; | 162 std::list<ProcessingComponent*> component_list_; |
156 CriticalSectionWrapper* crit_; | 163 CriticalSectionWrapper* crit_; |
| 164 rtc::ThreadChecker render_thread_checker_; |
| 165 rtc::ThreadChecker capture_thread_checker_; |
| 166 rtc::ThreadChecker signal_thread_checker_; |
157 rtc::scoped_ptr<AudioBuffer> render_audio_; | 167 rtc::scoped_ptr<AudioBuffer> render_audio_; |
158 rtc::scoped_ptr<AudioBuffer> capture_audio_; | 168 rtc::scoped_ptr<AudioBuffer> capture_audio_; |
159 rtc::scoped_ptr<AudioConverter> render_converter_; | 169 rtc::scoped_ptr<AudioConverter> render_converter_; |
160 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 170 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
161 // TODO(andrew): make this more graceful. Ideally we would split this stuff | 171 // TODO(andrew): make this more graceful. Ideally we would split this stuff |
162 // out into a separate class with an "enabled" and "disabled" implementation. | 172 // out into a separate class with an "enabled" and "disabled" implementation. |
163 int WriteMessageToDebugFile(); | 173 int WriteMessageToDebugFile(); |
164 int WriteInitMessage(); | 174 int WriteInitMessage(); |
165 | 175 |
166 // Writes Config message. If not |forced|, only writes the current config if | 176 // Writes Config message. If not |forced|, only writes the current config if |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 const std::vector<Point> array_geometry_; | 229 const std::vector<Point> array_geometry_; |
220 const SphericalPointf target_direction_; | 230 const SphericalPointf target_direction_; |
221 | 231 |
222 bool intelligibility_enabled_; | 232 bool intelligibility_enabled_; |
223 rtc::scoped_ptr<IntelligibilityEnhancer> intelligibility_enhancer_; | 233 rtc::scoped_ptr<IntelligibilityEnhancer> intelligibility_enhancer_; |
224 }; | 234 }; |
225 | 235 |
226 } // namespace webrtc | 236 } // namespace webrtc |
227 | 237 |
228 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 238 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
OLD | NEW |