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

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

Issue 2415403002: Introduced the new parameter setting scheme for activating the high-pass filter in APM (Closed)
Patch Set: Changes in response to reviewer comments Created 4 years, 1 month 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
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 <memory> 15 #include <memory>
16 #include <string> 16 #include <string>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/base/criticalsection.h" 19 #include "webrtc/base/criticalsection.h"
20 #include "webrtc/base/function_view.h"
20 #include "webrtc/base/gtest_prod_util.h" 21 #include "webrtc/base/gtest_prod_util.h"
21 #include "webrtc/base/ignore_wundef.h" 22 #include "webrtc/base/ignore_wundef.h"
22 #include "webrtc/base/swap_queue.h" 23 #include "webrtc/base/swap_queue.h"
23 #include "webrtc/base/thread_annotations.h" 24 #include "webrtc/base/thread_annotations.h"
24 #include "webrtc/modules/audio_processing/audio_buffer.h" 25 #include "webrtc/modules/audio_processing/audio_buffer.h"
25 #include "webrtc/modules/audio_processing/include/audio_processing.h" 26 #include "webrtc/modules/audio_processing/include/audio_processing.h"
26 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h" 27 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h"
27 #include "webrtc/system_wrappers/include/file_wrapper.h" 28 #include "webrtc/system_wrappers/include/file_wrapper.h"
28 29
29 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 30 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); 118 EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
118 119
119 // Methods returning pointers to APM submodules. 120 // Methods returning pointers to APM submodules.
120 // No locks are aquired in those, as those locks 121 // No locks are aquired in those, as those locks
121 // would offer no protection (the submodules are 122 // would offer no protection (the submodules are
122 // created only once in a single-treaded manner 123 // created only once in a single-treaded manner
123 // during APM creation). 124 // during APM creation).
124 EchoCancellation* echo_cancellation() const override; 125 EchoCancellation* echo_cancellation() const override;
125 EchoControlMobile* echo_control_mobile() const override; 126 EchoControlMobile* echo_control_mobile() const override;
126 GainControl* gain_control() const override; 127 GainControl* gain_control() const override;
128 // TODO(peah): Deprecate this API call.
127 HighPassFilter* high_pass_filter() const override; 129 HighPassFilter* high_pass_filter() const override;
128 LevelEstimator* level_estimator() const override; 130 LevelEstimator* level_estimator() const override;
129 NoiseSuppression* noise_suppression() const override; 131 NoiseSuppression* noise_suppression() const override;
130 VoiceDetection* voice_detection() const override; 132 VoiceDetection* voice_detection() const override;
131 133
134 // TODO(peah): Remove these two methods once the new API allows that.
135 void MutateConfig(std::function<void(AudioProcessing::Config*)> mutator);
136 AudioProcessing::Config GetConfig() const;
137
132 protected: 138 protected:
133 // Overridden in a mock. 139 // Overridden in a mock.
134 virtual int InitializeLocked() 140 virtual int InitializeLocked()
135 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 141 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
136 142
137 private: 143 private:
138 // TODO(peah): These friend classes should be removed as soon as the new 144 // TODO(peah): These friend classes should be removed as soon as the new
139 // parameter setting scheme allows. 145 // parameter setting scheme allows.
140 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, DefaultBehavior); 146 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, DefaultBehavior);
141 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, ValidConfigBehavior); 147 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, ValidConfigBehavior);
142 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, InValidConfigBehavior); 148 FRIEND_TEST_ALL_PREFIXES(ApmConfiguration, InValidConfigBehavior);
143 struct ApmPublicSubmodules; 149 struct ApmPublicSubmodules;
144 struct ApmPrivateSubmodules; 150 struct ApmPrivateSubmodules;
145 151
152 // Submodule interface implementations.
153 std::unique_ptr<HighPassFilter> high_pass_filter_impl_;
154
146 class ApmSubmoduleStates { 155 class ApmSubmoduleStates {
147 public: 156 public:
148 ApmSubmoduleStates(); 157 ApmSubmoduleStates();
149 // Updates the submodule state and returns true if it has changed. 158 // Updates the submodule state and returns true if it has changed.
150 bool Update(bool high_pass_filter_enabled, 159 bool Update(bool low_cut_filter_enabled,
the sun 2016/10/28 12:38:32 I'm not so sure about this use of low cut vs high
peah-webrtc 2016/10/28 12:47:46 I agree that it is confusing. But I think using th
151 bool echo_canceller_enabled, 160 bool echo_canceller_enabled,
152 bool mobile_echo_controller_enabled, 161 bool mobile_echo_controller_enabled,
153 bool noise_suppressor_enabled, 162 bool noise_suppressor_enabled,
154 bool intelligibility_enhancer_enabled, 163 bool intelligibility_enhancer_enabled,
155 bool beamformer_enabled, 164 bool beamformer_enabled,
156 bool adaptive_gain_controller_enabled, 165 bool adaptive_gain_controller_enabled,
157 bool level_controller_enabled, 166 bool level_controller_enabled,
158 bool voice_activity_detector_enabled, 167 bool voice_activity_detector_enabled,
159 bool level_estimator_enabled, 168 bool level_estimator_enabled,
160 bool transient_suppressor_enabled); 169 bool transient_suppressor_enabled);
161 bool CaptureMultiBandSubModulesActive() const; 170 bool CaptureMultiBandSubModulesActive() const;
162 bool CaptureMultiBandProcessingActive() const; 171 bool CaptureMultiBandProcessingActive() const;
163 bool RenderMultiBandSubModulesActive() const; 172 bool RenderMultiBandSubModulesActive() const;
164 bool RenderMultiBandProcessingActive() const; 173 bool RenderMultiBandProcessingActive() const;
165 174
166 private: 175 private:
167 bool high_pass_filter_enabled_ = false; 176 bool low_cut_filter_enabled_ = false;
168 bool echo_canceller_enabled_ = false; 177 bool echo_canceller_enabled_ = false;
169 bool mobile_echo_controller_enabled_ = false; 178 bool mobile_echo_controller_enabled_ = false;
170 bool noise_suppressor_enabled_ = false; 179 bool noise_suppressor_enabled_ = false;
171 bool intelligibility_enhancer_enabled_ = false; 180 bool intelligibility_enhancer_enabled_ = false;
172 bool beamformer_enabled_ = false; 181 bool beamformer_enabled_ = false;
173 bool adaptive_gain_controller_enabled_ = false; 182 bool adaptive_gain_controller_enabled_ = false;
174 bool level_controller_enabled_ = false; 183 bool level_controller_enabled_ = false;
175 bool level_estimator_enabled_ = false; 184 bool level_estimator_enabled_ = false;
176 bool voice_activity_detector_enabled_ = false; 185 bool voice_activity_detector_enabled_ = false;
177 bool transient_suppressor_enabled_ = false; 186 bool transient_suppressor_enabled_ = false;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // acquired. 236 // acquired.
228 void InitializeTransient() 237 void InitializeTransient()
229 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 238 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
230 void InitializeBeamformer() 239 void InitializeBeamformer()
231 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 240 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
232 void InitializeIntelligibility() 241 void InitializeIntelligibility()
233 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 242 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
234 int InitializeLocked(const ProcessingConfig& config) 243 int InitializeLocked(const ProcessingConfig& config)
235 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 244 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
236 void InitializeLevelController() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); 245 void InitializeLevelController() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
246 void InitializeLowCutFilter() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
237 247
238 void EmptyQueuedRenderAudio(); 248 void EmptyQueuedRenderAudio();
239 void AllocateRenderQueue() 249 void AllocateRenderQueue()
240 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_); 250 EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);
241 void QueueRenderAudio(AudioBuffer* audio) 251 void QueueRenderAudio(AudioBuffer* audio)
242 EXCLUSIVE_LOCKS_REQUIRED(crit_render_); 252 EXCLUSIVE_LOCKS_REQUIRED(crit_render_);
243 253
244 // Capture-side exclusive methods possibly running APM in a multi-threaded 254 // Capture-side exclusive methods possibly running APM in a multi-threaded
245 // manner that are called with the render lock already acquired. 255 // manner that are called with the render lock already acquired.
246 int ProcessCaptureStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); 256 int ProcessCaptureStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> 403 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
394 aecm_render_signal_queue_; 404 aecm_render_signal_queue_;
395 std::unique_ptr< 405 std::unique_ptr<
396 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> 406 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
397 agc_render_signal_queue_; 407 agc_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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698