OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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_CODING_MAIN_ACM2_ACM_COMMON_DEFS_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_COMMON_DEFS_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_COMMON_DEFS_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_COMMON_DEFS_H_ |
13 | 13 |
14 #include <string.h> | |
15 | |
16 #include "webrtc/common_types.h" | |
17 #include "webrtc/engine_configurations.h" | 14 #include "webrtc/engine_configurations.h" |
18 #include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedef
s.h" | |
19 #include "webrtc/typedefs.h" | |
20 | 15 |
21 // Checks for enabled codecs, we prevent enabling codecs which are not | 16 // Checks for enabled codecs, we prevent enabling codecs which are not |
22 // compatible. | 17 // compatible. |
23 #if ((defined WEBRTC_CODEC_ISAC) && (defined WEBRTC_CODEC_ISACFX)) | 18 #if ((defined WEBRTC_CODEC_ISAC) && (defined WEBRTC_CODEC_ISACFX)) |
24 #error iSAC and iSACFX codecs cannot be enabled at the same time | 19 #error iSAC and iSACFX codecs cannot be enabled at the same time |
25 #endif | 20 #endif |
26 | 21 |
27 | |
28 namespace webrtc { | 22 namespace webrtc { |
29 | 23 |
30 // 60 ms is the maximum block size we support. An extra 20 ms is considered | |
31 // for safety if process() method is not called when it should be, i.e. we | |
32 // accept 20 ms of jitter. 80 ms @ 48 kHz (full-band) stereo is 7680 samples. | |
33 #define AUDIO_BUFFER_SIZE_W16 7680 | |
34 | |
35 // There is one timestamp per each 10 ms of audio | |
36 // the audio buffer, at max, may contain 32 blocks of 10ms | |
37 // audio if the sampling frequency is 8000 Hz (80 samples per block). | |
38 // Therefore, The size of the buffer where we keep timestamps | |
39 // is defined as follows | |
40 #define TIMESTAMP_BUFFER_SIZE_W32 (AUDIO_BUFFER_SIZE_W16/80) | |
41 | |
42 // The maximum size of a payload, that is 60 ms of PCM-16 @ 32 kHz stereo | 24 // The maximum size of a payload, that is 60 ms of PCM-16 @ 32 kHz stereo |
43 #define MAX_PAYLOAD_SIZE_BYTE 7680 | 25 #define MAX_PAYLOAD_SIZE_BYTE 7680 |
44 | 26 |
45 // General codec specific defines | 27 // General codec specific defines |
46 const int kIsacWbDefaultRate = 32000; | 28 const int kIsacWbDefaultRate = 32000; |
47 const int kIsacSwbDefaultRate = 56000; | 29 const int kIsacSwbDefaultRate = 56000; |
48 const int kIsacPacSize480 = 480; | 30 const int kIsacPacSize480 = 480; |
49 const int kIsacPacSize960 = 960; | 31 const int kIsacPacSize960 = 960; |
50 const int kIsacPacSize1440 = 1440; | 32 const int kIsacPacSize1440 = 1440; |
51 | 33 |
52 // A structure which contains codec parameters. For instance, used when | |
53 // initializing encoder and decoder. | |
54 // | |
55 // codec_inst: c.f. common_types.h | |
56 // enable_dtx: set true to enable DTX. If codec does not have | |
57 // internal DTX, this will enable VAD. | |
58 // enable_vad: set true to enable VAD. | |
59 // vad_mode: VAD mode, c.f. audio_coding_module_typedefs.h | |
60 // for possible values. | |
61 struct WebRtcACMCodecParams { | |
62 CodecInst codec_inst; | |
63 bool enable_dtx; | |
64 bool enable_vad; | |
65 ACMVADMode vad_mode; | |
66 }; | |
67 | |
68 // TODO(turajs): Remove when ACM1 is removed. | |
69 struct WebRtcACMAudioBuff { | |
70 int16_t in_audio[AUDIO_BUFFER_SIZE_W16]; | |
71 int16_t in_audio_ix_read; | |
72 int16_t in_audio_ix_write; | |
73 uint32_t in_timestamp[TIMESTAMP_BUFFER_SIZE_W32]; | |
74 int16_t in_timestamp_ix_write; | |
75 uint32_t last_timestamp; | |
76 uint32_t last_in_timestamp; | |
77 }; | |
78 | |
79 } // namespace webrtc | 34 } // namespace webrtc |
80 | 35 |
81 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_COMMON_DEFS_H_ | 36 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_COMMON_DEFS_H_ |
OLD | NEW |