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 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 struct ApmPublicSubmodules; | 143 struct ApmPublicSubmodules; |
144 struct ApmPrivateSubmodules; | 144 struct ApmPrivateSubmodules; |
145 | 145 |
146 class ApmSubmoduleStates { | 146 class ApmSubmoduleStates { |
147 public: | 147 public: |
148 ApmSubmoduleStates(); | 148 ApmSubmoduleStates(); |
149 // Updates the submodule state and returns true if it has changed. | 149 // Updates the submodule state and returns true if it has changed. |
150 bool Update(bool high_pass_filter_enabled, | 150 bool Update(bool high_pass_filter_enabled, |
151 bool echo_canceller_enabled, | 151 bool echo_canceller_enabled, |
152 bool mobile_echo_controller_enabled, | 152 bool mobile_echo_controller_enabled, |
| 153 bool residual_echo_detector_enabled, |
153 bool noise_suppressor_enabled, | 154 bool noise_suppressor_enabled, |
154 bool intelligibility_enhancer_enabled, | 155 bool intelligibility_enhancer_enabled, |
155 bool beamformer_enabled, | 156 bool beamformer_enabled, |
156 bool adaptive_gain_controller_enabled, | 157 bool adaptive_gain_controller_enabled, |
157 bool level_controller_enabled, | 158 bool level_controller_enabled, |
158 bool voice_activity_detector_enabled, | 159 bool voice_activity_detector_enabled, |
159 bool level_estimator_enabled, | 160 bool level_estimator_enabled, |
160 bool transient_suppressor_enabled); | 161 bool transient_suppressor_enabled); |
161 bool CaptureMultiBandSubModulesActive() const; | 162 bool CaptureMultiBandSubModulesActive() const; |
162 bool CaptureMultiBandProcessingActive() const; | 163 bool CaptureMultiBandProcessingActive() const; |
163 bool RenderMultiBandSubModulesActive() const; | 164 bool RenderMultiBandSubModulesActive() const; |
164 bool RenderMultiBandProcessingActive() const; | 165 bool RenderMultiBandProcessingActive() const; |
165 | 166 |
166 private: | 167 private: |
167 bool high_pass_filter_enabled_ = false; | 168 bool high_pass_filter_enabled_ = false; |
168 bool echo_canceller_enabled_ = false; | 169 bool echo_canceller_enabled_ = false; |
169 bool mobile_echo_controller_enabled_ = false; | 170 bool mobile_echo_controller_enabled_ = false; |
| 171 bool residual_echo_detector_enabled_ = false; |
170 bool noise_suppressor_enabled_ = false; | 172 bool noise_suppressor_enabled_ = false; |
171 bool intelligibility_enhancer_enabled_ = false; | 173 bool intelligibility_enhancer_enabled_ = false; |
172 bool beamformer_enabled_ = false; | 174 bool beamformer_enabled_ = false; |
173 bool adaptive_gain_controller_enabled_ = false; | 175 bool adaptive_gain_controller_enabled_ = false; |
174 bool level_controller_enabled_ = false; | 176 bool level_controller_enabled_ = false; |
175 bool level_estimator_enabled_ = false; | 177 bool level_estimator_enabled_ = false; |
176 bool voice_activity_detector_enabled_ = false; | 178 bool voice_activity_detector_enabled_ = false; |
177 bool transient_suppressor_enabled_ = false; | 179 bool transient_suppressor_enabled_ = false; |
178 bool first_update_ = true; | 180 bool first_update_ = true; |
179 }; | 181 }; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // acquired. | 229 // acquired. |
228 void InitializeTransient() | 230 void InitializeTransient() |
229 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 231 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
230 void InitializeBeamformer() | 232 void InitializeBeamformer() |
231 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 233 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
232 void InitializeIntelligibility() | 234 void InitializeIntelligibility() |
233 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 235 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
234 int InitializeLocked(const ProcessingConfig& config) | 236 int InitializeLocked(const ProcessingConfig& config) |
235 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 237 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
236 void InitializeLevelController() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); | 238 void InitializeLevelController() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
| 239 void InitializeResidualEchoDetector() |
| 240 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
237 | 241 |
238 void EmptyQueuedRenderAudio(); | 242 void EmptyQueuedRenderAudio(); |
239 void AllocateRenderQueue() | 243 void AllocateRenderQueue() |
240 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); | 244 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); |
241 void QueueRenderAudio(AudioBuffer* audio) | 245 void QueueRenderAudio(AudioBuffer* audio) |
242 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); | 246 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); |
243 | 247 |
244 // Capture-side exclusive methods possibly running APM in a multi-threaded | 248 // Capture-side exclusive methods possibly running APM in a multi-threaded |
245 // manner that are called with the render lock already acquired. | 249 // manner that are called with the render lock already acquired. |
246 int ProcessCaptureStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); | 250 int ProcessCaptureStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 rtc::CriticalSection crit_capture_; | 288 rtc::CriticalSection crit_capture_; |
285 | 289 |
286 // Struct containing the Config specifying the behavior of APM. | 290 // Struct containing the Config specifying the behavior of APM. |
287 AudioProcessing::Config config_; | 291 AudioProcessing::Config config_; |
288 | 292 |
289 // Class containing information about what submodules are active. | 293 // Class containing information about what submodules are active. |
290 ApmSubmoduleStates submodule_states_; | 294 ApmSubmoduleStates submodule_states_; |
291 | 295 |
292 // Structs containing the pointers to the submodules. | 296 // Structs containing the pointers to the submodules. |
293 std::unique_ptr<ApmPublicSubmodules> public_submodules_; | 297 std::unique_ptr<ApmPublicSubmodules> public_submodules_; |
294 std::unique_ptr<ApmPrivateSubmodules> private_submodules_ | 298 std::unique_ptr<ApmPrivateSubmodules> private_submodules_; |
295 GUARDED_BY(crit_capture_); | |
296 | 299 |
297 // State that is written to while holding both the render and capture locks | 300 // State that is written to while holding both the render and capture locks |
298 // but can be read without any lock being held. | 301 // but can be read without any lock being held. |
299 // As this is only accessed internally of APM, and all internal methods in APM | 302 // As this is only accessed internally of APM, and all internal methods in APM |
300 // either are holding the render or capture locks, this construct is safe as | 303 // either are holding the render or capture locks, this construct is safe as |
301 // it is not possible to read the variables while writing them. | 304 // it is not possible to read the variables while writing them. |
302 struct ApmFormatState { | 305 struct ApmFormatState { |
303 ApmFormatState() | 306 ApmFormatState() |
304 : // Format of processing streams at input/output call sites. | 307 : // Format of processing streams at input/output call sites. |
305 api_format({{{kSampleRate16kHz, 1, false}, | 308 api_format({{{kSampleRate16kHz, 1, false}, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 size_t aecm_render_queue_element_max_size_ GUARDED_BY(crit_render_) | 382 size_t aecm_render_queue_element_max_size_ GUARDED_BY(crit_render_) |
380 GUARDED_BY(crit_capture_) = 0; | 383 GUARDED_BY(crit_capture_) = 0; |
381 std::vector<int16_t> aecm_render_queue_buffer_ GUARDED_BY(crit_render_); | 384 std::vector<int16_t> aecm_render_queue_buffer_ GUARDED_BY(crit_render_); |
382 std::vector<int16_t> aecm_capture_queue_buffer_ GUARDED_BY(crit_capture_); | 385 std::vector<int16_t> aecm_capture_queue_buffer_ GUARDED_BY(crit_capture_); |
383 | 386 |
384 size_t agc_render_queue_element_max_size_ GUARDED_BY(crit_render_) | 387 size_t agc_render_queue_element_max_size_ GUARDED_BY(crit_render_) |
385 GUARDED_BY(crit_capture_) = 0; | 388 GUARDED_BY(crit_capture_) = 0; |
386 std::vector<int16_t> agc_render_queue_buffer_ GUARDED_BY(crit_render_); | 389 std::vector<int16_t> agc_render_queue_buffer_ GUARDED_BY(crit_render_); |
387 std::vector<int16_t> agc_capture_queue_buffer_ GUARDED_BY(crit_capture_); | 390 std::vector<int16_t> agc_capture_queue_buffer_ GUARDED_BY(crit_capture_); |
388 | 391 |
| 392 size_t red_render_queue_element_max_size_ GUARDED_BY(crit_render_) |
| 393 GUARDED_BY(crit_capture_) = 0; |
| 394 std::vector<float> red_render_queue_buffer_ GUARDED_BY(crit_render_); |
| 395 std::vector<float> red_capture_queue_buffer_ GUARDED_BY(crit_capture_); |
| 396 |
389 // Lock protection not needed. | 397 // Lock protection not needed. |
390 std::unique_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>> | 398 std::unique_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>> |
391 aec_render_signal_queue_; | 399 aec_render_signal_queue_; |
392 std::unique_ptr< | 400 std::unique_ptr< |
393 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> | 401 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> |
394 aecm_render_signal_queue_; | 402 aecm_render_signal_queue_; |
395 std::unique_ptr< | 403 std::unique_ptr< |
396 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> | 404 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> |
397 agc_render_signal_queue_; | 405 agc_render_signal_queue_; |
| 406 std::unique_ptr<SwapQueue<std::vector<float>, RenderQueueItemVerifier<float>>> |
| 407 red_render_signal_queue_; |
398 }; | 408 }; |
399 | 409 |
400 } // namespace webrtc | 410 } // namespace webrtc |
401 | 411 |
402 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 412 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
OLD | NEW |