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_INCLUDE_AUDIO_PROCESSING_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
13 | 13 |
14 // MSVC++ requires this to be set before any other includes to get M_PI. | 14 // MSVC++ requires this to be set before any other includes to get M_PI. |
15 #define _USE_MATH_DEFINES | 15 #define _USE_MATH_DEFINES |
16 | 16 |
17 #include <math.h> | 17 #include <math.h> |
18 #include <stddef.h> // size_t | 18 #include <stddef.h> // size_t |
19 #include <stdio.h> // FILE | 19 #include <stdio.h> // FILE |
20 #include <vector> | 20 #include <vector> |
21 | 21 |
22 #include "webrtc/base/arraysize.h" | 22 #include "webrtc/base/arraysize.h" |
23 #include "webrtc/base/platform_file.h" | 23 #include "webrtc/base/platform_file.h" |
| 24 #include "webrtc/base/refcount.h" |
24 #include "webrtc/modules/audio_processing/beamformer/array_util.h" | 25 #include "webrtc/modules/audio_processing/beamformer/array_util.h" |
25 #include "webrtc/modules/audio_processing/include/config.h" | 26 #include "webrtc/modules/audio_processing/include/config.h" |
26 #include "webrtc/typedefs.h" | 27 #include "webrtc/typedefs.h" |
27 | 28 |
28 namespace webrtc { | 29 namespace webrtc { |
29 | 30 |
30 struct AecCore; | 31 struct AecCore; |
31 | 32 |
32 class AecDump; | 33 class AecDump; |
33 class AudioFrame; | 34 class AudioFrame; |
(...skipping 192 matching lines...) Loading... |
226 // analog_level = apm->gain_control()->stream_analog_level(); | 227 // analog_level = apm->gain_control()->stream_analog_level(); |
227 // has_voice = apm->stream_has_voice(); | 228 // has_voice = apm->stream_has_voice(); |
228 // | 229 // |
229 // // Repeate render and capture processing for the duration of the call... | 230 // // Repeate render and capture processing for the duration of the call... |
230 // // Start a new call... | 231 // // Start a new call... |
231 // apm->Initialize(); | 232 // apm->Initialize(); |
232 // | 233 // |
233 // // Close the application... | 234 // // Close the application... |
234 // delete apm; | 235 // delete apm; |
235 // | 236 // |
236 class AudioProcessing { | 237 class AudioProcessing : public rtc::RefCountInterface { |
237 public: | 238 public: |
238 // The struct below constitutes the new parameter scheme for the audio | 239 // The struct below constitutes the new parameter scheme for the audio |
239 // processing. It is being introduced gradually and until it is fully | 240 // processing. It is being introduced gradually and until it is fully |
240 // introduced, it is prone to change. | 241 // introduced, it is prone to change. |
241 // TODO(peah): Remove this comment once the new config scheme is fully rolled | 242 // TODO(peah): Remove this comment once the new config scheme is fully rolled |
242 // out. | 243 // out. |
243 // | 244 // |
244 // The parameters and behavior of the audio processing module are controlled | 245 // The parameters and behavior of the audio processing module are controlled |
245 // by changing the default values in the AudioProcessing::Config struct. | 246 // by changing the default values in the AudioProcessing::Config struct. |
246 // The config is applied by passing the struct to the ApplyConfig method. | 247 // The config is applied by passing the struct to the ApplyConfig method. |
(...skipping 46 matching lines...) Loading... |
293 // requiring processing. On the client-side, this would typically be one | 294 // requiring processing. On the client-side, this would typically be one |
294 // instance for the near-end stream, and additional instances for each far-end | 295 // instance for the near-end stream, and additional instances for each far-end |
295 // stream which requires processing. On the server-side, this would typically | 296 // stream which requires processing. On the server-side, this would typically |
296 // be one instance for every incoming stream. | 297 // be one instance for every incoming stream. |
297 static AudioProcessing* Create(); | 298 static AudioProcessing* Create(); |
298 // Allows passing in an optional configuration at create-time. | 299 // Allows passing in an optional configuration at create-time. |
299 static AudioProcessing* Create(const webrtc::Config& config); | 300 static AudioProcessing* Create(const webrtc::Config& config); |
300 // Only for testing. | 301 // Only for testing. |
301 static AudioProcessing* Create(const webrtc::Config& config, | 302 static AudioProcessing* Create(const webrtc::Config& config, |
302 NonlinearBeamformer* beamformer); | 303 NonlinearBeamformer* beamformer); |
303 virtual ~AudioProcessing() {} | 304 ~AudioProcessing() override {} |
304 | 305 |
305 // Initializes internal states, while retaining all user settings. This | 306 // Initializes internal states, while retaining all user settings. This |
306 // should be called before beginning to process a new audio stream. However, | 307 // should be called before beginning to process a new audio stream. However, |
307 // it is not necessary to call before processing the first stream after | 308 // it is not necessary to call before processing the first stream after |
308 // creation. | 309 // creation. |
309 // | 310 // |
310 // It is also not necessary to call if the audio parameters (sample | 311 // It is also not necessary to call if the audio parameters (sample |
311 // rate and number of channels) have changed. Passing updated parameters | 312 // rate and number of channels) have changed. Passing updated parameters |
312 // directly to |ProcessStream()| and |ProcessReverseStream()| is permissible. | 313 // directly to |ProcessStream()| and |ProcessReverseStream()| is permissible. |
313 // If the parameters are known at init-time though, they may be provided. | 314 // If the parameters are known at init-time though, they may be provided. |
(...skipping 783 matching lines...) Loading... |
1097 // This does not impact the size of frames passed to |ProcessStream()|. | 1098 // This does not impact the size of frames passed to |ProcessStream()|. |
1098 virtual int set_frame_size_ms(int size) = 0; | 1099 virtual int set_frame_size_ms(int size) = 0; |
1099 virtual int frame_size_ms() const = 0; | 1100 virtual int frame_size_ms() const = 0; |
1100 | 1101 |
1101 protected: | 1102 protected: |
1102 virtual ~VoiceDetection() {} | 1103 virtual ~VoiceDetection() {} |
1103 }; | 1104 }; |
1104 } // namespace webrtc | 1105 } // namespace webrtc |
1105 | 1106 |
1106 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 1107 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
OLD | NEW |