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 #include <stddef.h> // size_t | 14 #include <stddef.h> // size_t |
15 #include <stdio.h> // FILE | 15 #include <stdio.h> // FILE |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
| 18 #include "webrtc/base/arraysize.h" |
18 #include "webrtc/base/platform_file.h" | 19 #include "webrtc/base/platform_file.h" |
19 #include "webrtc/common.h" | 20 #include "webrtc/common.h" |
20 #include "webrtc/modules/audio_processing/beamformer/array_util.h" | 21 #include "webrtc/modules/audio_processing/beamformer/array_util.h" |
21 #include "webrtc/typedefs.h" | 22 #include "webrtc/typedefs.h" |
22 | 23 |
23 struct AecCore; | 24 struct AecCore; |
24 | 25 |
25 namespace webrtc { | 26 namespace webrtc { |
26 | 27 |
27 class AudioFrame; | 28 class AudioFrame; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // AudioProcessing::SetExtraOptions(). | 122 // AudioProcessing::SetExtraOptions(). |
122 // | 123 // |
123 // Note: If enabled and the reverse stream has more than one output channel, | 124 // Note: If enabled and the reverse stream has more than one output channel, |
124 // the reverse stream will become an upmixed mono signal. | 125 // the reverse stream will become an upmixed mono signal. |
125 struct Intelligibility { | 126 struct Intelligibility { |
126 Intelligibility() : enabled(false) {} | 127 Intelligibility() : enabled(false) {} |
127 explicit Intelligibility(bool enabled) : enabled(enabled) {} | 128 explicit Intelligibility(bool enabled) : enabled(enabled) {} |
128 bool enabled; | 129 bool enabled; |
129 }; | 130 }; |
130 | 131 |
131 static const int kAudioProcMaxNativeSampleRateHz = 32000; | |
132 | |
133 // The Audio Processing Module (APM) provides a collection of voice processing | 132 // The Audio Processing Module (APM) provides a collection of voice processing |
134 // components designed for real-time communications software. | 133 // components designed for real-time communications software. |
135 // | 134 // |
136 // APM operates on two audio streams on a frame-by-frame basis. Frames of the | 135 // APM operates on two audio streams on a frame-by-frame basis. Frames of the |
137 // primary stream, on which all processing is applied, are passed to | 136 // primary stream, on which all processing is applied, are passed to |
138 // |ProcessStream()|. Frames of the reverse direction stream, which are used for | 137 // |ProcessStream()|. Frames of the reverse direction stream, which are used for |
139 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the | 138 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the |
140 // client-side, this will typically be the near-end (capture) and far-end | 139 // client-side, this will typically be the near-end (capture) and far-end |
141 // (render) streams, respectively. APM should be placed in the signal chain as | 140 // (render) streams, respectively. APM should be placed in the signal chain as |
142 // close to the audio hardware abstraction layer (HAL) as possible. | 141 // close to the audio hardware abstraction layer (HAL) as possible. |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 kBadStreamParameterWarning = -13 | 463 kBadStreamParameterWarning = -13 |
465 }; | 464 }; |
466 | 465 |
467 enum NativeRate { | 466 enum NativeRate { |
468 kSampleRate8kHz = 8000, | 467 kSampleRate8kHz = 8000, |
469 kSampleRate16kHz = 16000, | 468 kSampleRate16kHz = 16000, |
470 kSampleRate32kHz = 32000, | 469 kSampleRate32kHz = 32000, |
471 kSampleRate48kHz = 48000 | 470 kSampleRate48kHz = 48000 |
472 }; | 471 }; |
473 | 472 |
| 473 static const int kNativeSampleRatesHz[]; |
| 474 static const size_t kNumNativeSampleRates; |
| 475 static const int kMaxNativeSampleRateHz; |
| 476 static const int kMaxAECMSampleRateHz; |
| 477 |
474 static const int kChunkSizeMs = 10; | 478 static const int kChunkSizeMs = 10; |
475 }; | 479 }; |
476 | 480 |
477 class StreamConfig { | 481 class StreamConfig { |
478 public: | 482 public: |
479 // sample_rate_hz: The sampling rate of the stream. | 483 // sample_rate_hz: The sampling rate of the stream. |
480 // | 484 // |
481 // num_channels: The number of audio channels in the stream, excluding the | 485 // num_channels: The number of audio channels in the stream, excluding the |
482 // keyboard channel if it is present. When passing a | 486 // keyboard channel if it is present. When passing a |
483 // StreamConfig with an array of arrays T*[N], | 487 // StreamConfig with an array of arrays T*[N], |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 // This does not impact the size of frames passed to |ProcessStream()|. | 940 // This does not impact the size of frames passed to |ProcessStream()|. |
937 virtual int set_frame_size_ms(int size) = 0; | 941 virtual int set_frame_size_ms(int size) = 0; |
938 virtual int frame_size_ms() const = 0; | 942 virtual int frame_size_ms() const = 0; |
939 | 943 |
940 protected: | 944 protected: |
941 virtual ~VoiceDetection() {} | 945 virtual ~VoiceDetection() {} |
942 }; | 946 }; |
943 } // namespace webrtc | 947 } // namespace webrtc |
944 | 948 |
945 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 949 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
OLD | NEW |