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 26 matching lines...) Expand all Loading... | |
37 class ProcessingConfig; | 37 class ProcessingConfig; |
38 | 38 |
39 class EchoCancellation; | 39 class EchoCancellation; |
40 class EchoControlMobile; | 40 class EchoControlMobile; |
41 class GainControl; | 41 class GainControl; |
42 class HighPassFilter; | 42 class HighPassFilter; |
43 class LevelEstimator; | 43 class LevelEstimator; |
44 class NoiseSuppression; | 44 class NoiseSuppression; |
45 class VoiceDetection; | 45 class VoiceDetection; |
46 | 46 |
47 // The struct below constitutes the new parameter scheme for the | |
48 // audio processing functionality. It is being introduced gradually and | |
49 // until it is fully introduced, it is prone to change. | |
50 // | |
51 // The parameters and behavior of the audio processing module is speficied | |
hlundin-webrtc
2016/08/30 11:26:26
speficied -> specified
hlundin-webrtc
2016/08/30 11:26:26
is -> are
peah-webrtc
2016/08/30 17:05:58
Done.
peah-webrtc
2016/08/30 17:05:58
Done.
| |
52 // by changing the default values in the ApmSettings struct. It is possible | |
hlundin-webrtc
2016/08/30 11:26:26
The parameters and behavior are in fact specified
peah-webrtc
2016/08/30 17:05:57
Done.
| |
53 // to verify the specified parameters by calling the IsOk method for each | |
54 // substruct. The settings are applied by passing the struct to the | |
hlundin-webrtc
2016/08/30 11:26:26
What happens if I call ApmSettings::IsOk()? Will i
peah-webrtc
2016/08/30 17:05:57
Yes, I added a comment about that.
| |
55 // ApplySettings | |
hlundin-webrtc
2016/08/30 11:26:26
Line wrapping is odd.
peah-webrtc
2016/08/30 17:05:58
Done.
| |
56 // method in the audio processing interface. | |
57 struct ApmSettings { | |
the sun
2016/08/30 10:32:39
name this Config and put it inside the AudioProces
hlundin-webrtc
2016/08/30 11:26:26
+1
peah-webrtc
2016/08/30 17:05:57
Done.
peah-webrtc
2016/08/30 17:05:57
Done.
| |
58 struct LevelControllerSettings { | |
hlundin-webrtc
2016/08/30 11:26:26
Should the substructs' configs be declared here or
peah-webrtc
2016/08/30 17:05:57
I don't think that we should allow/require audio_p
| |
59 bool enabled = false; | |
60 bool IsOk() const; | |
61 } level_controller; | |
62 bool IsOk() const; | |
63 }; | |
64 | |
47 // Use to enable the extended filter mode in the AEC, along with robustness | 65 // Use to enable the extended filter mode in the AEC, along with robustness |
48 // measures around the reported system delays. It comes with a significant | 66 // measures around the reported system delays. It comes with a significant |
49 // increase in AEC complexity, but is much more robust to unreliable reported | 67 // increase in AEC complexity, but is much more robust to unreliable reported |
50 // delays. | 68 // delays. |
51 // | 69 // |
52 // Detailed changes to the algorithm: | 70 // Detailed changes to the algorithm: |
53 // - The filter length is changed from 48 to 128 ms. This comes with tuning of | 71 // - The filter length is changed from 48 to 128 ms. This comes with tuning of |
54 // several parameters: i) filter adaptation stepsize and error threshold; | 72 // several parameters: i) filter adaptation stepsize and error threshold; |
55 // ii) non-linear processing smoothing and overdrive. | 73 // ii) non-linear processing smoothing and overdrive. |
56 // - Option to ignore the reported delays on platforms which we deem | 74 // - Option to ignore the reported delays on platforms which we deem |
(...skipping 27 matching lines...) Expand all Loading... | |
84 // EchoControlMobile. It can be set in the constructor | 102 // EchoControlMobile. It can be set in the constructor |
85 // or using AudioProcessing::SetExtraOptions(). | 103 // or using AudioProcessing::SetExtraOptions(). |
86 struct RefinedAdaptiveFilter { | 104 struct RefinedAdaptiveFilter { |
87 RefinedAdaptiveFilter() : enabled(false) {} | 105 RefinedAdaptiveFilter() : enabled(false) {} |
88 explicit RefinedAdaptiveFilter(bool enabled) : enabled(enabled) {} | 106 explicit RefinedAdaptiveFilter(bool enabled) : enabled(enabled) {} |
89 static const ConfigOptionID identifier = | 107 static const ConfigOptionID identifier = |
90 ConfigOptionID::kAecRefinedAdaptiveFilter; | 108 ConfigOptionID::kAecRefinedAdaptiveFilter; |
91 bool enabled; | 109 bool enabled; |
92 }; | 110 }; |
93 | 111 |
94 // Enables the adaptive level controller. | |
95 struct LevelControl { | |
96 LevelControl() : enabled(false) {} | |
97 explicit LevelControl(bool enabled) : enabled(enabled) {} | |
98 static const ConfigOptionID identifier = ConfigOptionID::kLevelControl; | |
the sun
2016/08/30 10:32:39
Don't forget to remove ConfigOptionID::kLevelContr
peah-webrtc
2016/08/30 17:05:57
Can we do that? There is a comment in common.h tha
| |
99 bool enabled; | |
100 }; | |
101 | |
102 // Enables delay-agnostic echo cancellation. This feature relies on internally | 112 // Enables delay-agnostic echo cancellation. This feature relies on internally |
103 // estimated delays between the process and reverse streams, thus not relying | 113 // estimated delays between the process and reverse streams, thus not relying |
104 // on reported system delays. This configuration only applies to | 114 // on reported system delays. This configuration only applies to |
105 // EchoCancellation and not EchoControlMobile. It can be set in the constructor | 115 // EchoCancellation and not EchoControlMobile. It can be set in the constructor |
106 // or using AudioProcessing::SetExtraOptions(). | 116 // or using AudioProcessing::SetExtraOptions(). |
107 struct DelayAgnostic { | 117 struct DelayAgnostic { |
108 DelayAgnostic() : enabled(false) {} | 118 DelayAgnostic() : enabled(false) {} |
109 explicit DelayAgnostic(bool enabled) : enabled(enabled) {} | 119 explicit DelayAgnostic(bool enabled) : enabled(enabled) {} |
110 static const ConfigOptionID identifier = ConfigOptionID::kDelayAgnostic; | 120 static const ConfigOptionID identifier = ConfigOptionID::kDelayAgnostic; |
111 bool enabled; | 121 bool enabled; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 // 2. Parameter getters are never called concurrently with the corresponding | 208 // 2. Parameter getters are never called concurrently with the corresponding |
199 // setter. | 209 // setter. |
200 // | 210 // |
201 // APM accepts only linear PCM audio data in chunks of 10 ms. The int16 | 211 // APM accepts only linear PCM audio data in chunks of 10 ms. The int16 |
202 // interfaces use interleaved data, while the float interfaces use deinterleaved | 212 // interfaces use interleaved data, while the float interfaces use deinterleaved |
203 // data. | 213 // data. |
204 // | 214 // |
205 // Usage example, omitting error checking: | 215 // Usage example, omitting error checking: |
206 // AudioProcessing* apm = AudioProcessing::Create(0); | 216 // AudioProcessing* apm = AudioProcessing::Create(0); |
207 // | 217 // |
218 // ApmSettings settings; | |
219 // settings.level_controller_settings.enable = true; | |
220 // RTC_DCHECK(settings.IsOk()); | |
hlundin-webrtc
2016/08/30 11:26:26
The "user" should always verify the settings, not
peah-webrtc
2016/08/30 17:05:57
Good point! I edited it a bit. PTAL
the sun
2016/08/30 18:05:35
I disagree. We need to validate the config anyway,
peah-webrtc
2016/09/02 08:21:59
The argument by the other reviewer is that there a
hlundin-webrtc
2016/09/06 08:56:03
(Same comment as in later patch set, for completen
peah-webrtc
2016/09/07 05:42:59
Acknowledged.
| |
221 // apm->ApplySettings(settings); | |
222 // | |
208 // apm->high_pass_filter()->Enable(true); | 223 // apm->high_pass_filter()->Enable(true); |
209 // | 224 // |
210 // apm->echo_cancellation()->enable_drift_compensation(false); | 225 // apm->echo_cancellation()->enable_drift_compensation(false); |
211 // apm->echo_cancellation()->Enable(true); | 226 // apm->echo_cancellation()->Enable(true); |
212 // | 227 // |
213 // apm->noise_reduction()->set_level(kHighSuppression); | 228 // apm->noise_reduction()->set_level(kHighSuppression); |
214 // apm->noise_reduction()->Enable(true); | 229 // apm->noise_reduction()->Enable(true); |
215 // | 230 // |
216 // apm->gain_control()->set_analog_level_limits(0, 255); | 231 // apm->gain_control()->set_analog_level_limits(0, 255); |
217 // apm->gain_control()->set_mode(kAdaptiveAnalog); | 232 // apm->gain_control()->set_mode(kAdaptiveAnalog); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 // stream which requires processing. On the server-side, this would typically | 276 // stream which requires processing. On the server-side, this would typically |
262 // be one instance for every incoming stream. | 277 // be one instance for every incoming stream. |
263 static AudioProcessing* Create(); | 278 static AudioProcessing* Create(); |
264 // Allows passing in an optional configuration at create-time. | 279 // Allows passing in an optional configuration at create-time. |
265 static AudioProcessing* Create(const Config& config); | 280 static AudioProcessing* Create(const Config& config); |
266 // Only for testing. | 281 // Only for testing. |
267 static AudioProcessing* Create(const Config& config, | 282 static AudioProcessing* Create(const Config& config, |
268 NonlinearBeamformer* beamformer); | 283 NonlinearBeamformer* beamformer); |
269 virtual ~AudioProcessing() {} | 284 virtual ~AudioProcessing() {} |
270 | 285 |
286 virtual int ApplySettings(const ApmSettings& settings) = 0; | |
the sun
2016/08/30 10:32:38
- ApplyConfig()
- Add TODO(peah) that this is temp
peah-webrtc
2016/08/30 17:05:57
Done.
| |
287 | |
271 // Initializes internal states, while retaining all user settings. This | 288 // Initializes internal states, while retaining all user settings. This |
272 // should be called before beginning to process a new audio stream. However, | 289 // should be called before beginning to process a new audio stream. However, |
273 // it is not necessary to call before processing the first stream after | 290 // it is not necessary to call before processing the first stream after |
274 // creation. | 291 // creation. |
275 // | 292 // |
276 // It is also not necessary to call if the audio parameters (sample | 293 // It is also not necessary to call if the audio parameters (sample |
277 // rate and number of channels) have changed. Passing updated parameters | 294 // rate and number of channels) have changed. Passing updated parameters |
278 // directly to |ProcessStream()| and |ProcessReverseStream()| is permissible. | 295 // directly to |ProcessStream()| and |ProcessReverseStream()| is permissible. |
279 // If the parameters are known at init-time though, they may be provided. | 296 // If the parameters are known at init-time though, they may be provided. |
280 virtual int Initialize() = 0; | 297 virtual int Initialize() = 0; |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
974 // This does not impact the size of frames passed to |ProcessStream()|. | 991 // This does not impact the size of frames passed to |ProcessStream()|. |
975 virtual int set_frame_size_ms(int size) = 0; | 992 virtual int set_frame_size_ms(int size) = 0; |
976 virtual int frame_size_ms() const = 0; | 993 virtual int frame_size_ms() const = 0; |
977 | 994 |
978 protected: | 995 protected: |
979 virtual ~VoiceDetection() {} | 996 virtual ~VoiceDetection() {} |
980 }; | 997 }; |
981 } // namespace webrtc | 998 } // namespace webrtc |
982 | 999 |
983 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 1000 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
OLD | NEW |