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

Side by Side Diff: webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc

Issue 1424083002: Make an enum class out of NetEqDecoder, and hide the neteq_decoders_ table (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 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
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 int AudioDecoderCng::DecodeInternal(const uint8_t* encoded, 68 int AudioDecoderCng::DecodeInternal(const uint8_t* encoded,
69 size_t encoded_len, 69 size_t encoded_len,
70 int sample_rate_hz, 70 int sample_rate_hz,
71 int16_t* decoded, 71 int16_t* decoded,
72 SpeechType* speech_type) { 72 SpeechType* speech_type) {
73 return -1; 73 return -1;
74 } 74 }
75 75
76 bool CodecSupported(NetEqDecoder codec_type) { 76 bool CodecSupported(NetEqDecoder codec_type) {
77 switch (codec_type) { 77 switch (codec_type) {
78 case kDecoderPCMu: 78 case NetEqDecoder::kDecoderPCMu:
79 case kDecoderPCMa: 79 case NetEqDecoder::kDecoderPCMa:
80 case kDecoderPCMu_2ch: 80 case NetEqDecoder::kDecoderPCMu_2ch:
81 case kDecoderPCMa_2ch: 81 case NetEqDecoder::kDecoderPCMa_2ch:
82 #ifdef WEBRTC_CODEC_ILBC 82 #ifdef WEBRTC_CODEC_ILBC
83 case kDecoderILBC: 83 case NetEqDecoder::kDecoderILBC:
84 #endif 84 #endif
85 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC) 85 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
86 case kDecoderISAC: 86 case NetEqDecoder::kDecoderISAC:
87 #endif 87 #endif
88 #ifdef WEBRTC_CODEC_ISAC 88 #ifdef WEBRTC_CODEC_ISAC
89 case kDecoderISACswb: 89 case NetEqDecoder::kDecoderISACswb:
90 #endif 90 #endif
91 case kDecoderPCM16B: 91 case NetEqDecoder::kDecoderPCM16B:
92 case kDecoderPCM16Bwb: 92 case NetEqDecoder::kDecoderPCM16Bwb:
93 case kDecoderPCM16Bswb32kHz: 93 case NetEqDecoder::kDecoderPCM16Bswb32kHz:
94 case kDecoderPCM16Bswb48kHz: 94 case NetEqDecoder::kDecoderPCM16Bswb48kHz:
95 case kDecoderPCM16B_2ch: 95 case NetEqDecoder::kDecoderPCM16B_2ch:
96 case kDecoderPCM16Bwb_2ch: 96 case NetEqDecoder::kDecoderPCM16Bwb_2ch:
97 case kDecoderPCM16Bswb32kHz_2ch: 97 case NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch:
98 case kDecoderPCM16Bswb48kHz_2ch: 98 case NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch:
99 case kDecoderPCM16B_5ch: 99 case NetEqDecoder::kDecoderPCM16B_5ch:
100 #ifdef WEBRTC_CODEC_G722 100 #ifdef WEBRTC_CODEC_G722
101 case kDecoderG722: 101 case NetEqDecoder::kDecoderG722:
102 case kDecoderG722_2ch: 102 case NetEqDecoder::kDecoderG722_2ch:
103 #endif 103 #endif
104 #ifdef WEBRTC_CODEC_OPUS 104 #ifdef WEBRTC_CODEC_OPUS
105 case kDecoderOpus: 105 case NetEqDecoder::kDecoderOpus:
106 case kDecoderOpus_2ch: 106 case NetEqDecoder::kDecoderOpus_2ch:
107 #endif 107 #endif
108 case kDecoderRED: 108 case NetEqDecoder::kDecoderRED:
109 case kDecoderAVT: 109 case NetEqDecoder::kDecoderAVT:
110 case kDecoderCNGnb: 110 case NetEqDecoder::kDecoderCNGnb:
111 case kDecoderCNGwb: 111 case NetEqDecoder::kDecoderCNGwb:
112 case kDecoderCNGswb32kHz: 112 case NetEqDecoder::kDecoderCNGswb32kHz:
113 case kDecoderCNGswb48kHz: 113 case NetEqDecoder::kDecoderCNGswb48kHz:
114 case kDecoderArbitrary: { 114 case NetEqDecoder::kDecoderArbitrary: {
115 return true; 115 return true;
116 } 116 }
117 default: { 117 default: {
118 return false; 118 return false;
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 int CodecSampleRateHz(NetEqDecoder codec_type) { 123 int CodecSampleRateHz(NetEqDecoder codec_type) {
124 switch (codec_type) { 124 switch (codec_type) {
125 case kDecoderPCMu: 125 case NetEqDecoder::kDecoderPCMu:
126 case kDecoderPCMa: 126 case NetEqDecoder::kDecoderPCMa:
127 case kDecoderPCMu_2ch: 127 case NetEqDecoder::kDecoderPCMu_2ch:
128 case kDecoderPCMa_2ch: 128 case NetEqDecoder::kDecoderPCMa_2ch:
129 #ifdef WEBRTC_CODEC_ILBC 129 #ifdef WEBRTC_CODEC_ILBC
130 case kDecoderILBC: 130 case NetEqDecoder::kDecoderILBC:
131 #endif 131 #endif
132 case kDecoderPCM16B: 132 case NetEqDecoder::kDecoderPCM16B:
133 case kDecoderPCM16B_2ch: 133 case NetEqDecoder::kDecoderPCM16B_2ch:
134 case kDecoderPCM16B_5ch: 134 case NetEqDecoder::kDecoderPCM16B_5ch:
135 case kDecoderCNGnb: { 135 case NetEqDecoder::kDecoderCNGnb: {
136 return 8000; 136 return 8000;
137 } 137 }
138 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC) 138 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
139 case kDecoderISAC: 139 case NetEqDecoder::kDecoderISAC:
140 #endif 140 #endif
141 case kDecoderPCM16Bwb: 141 case NetEqDecoder::kDecoderPCM16Bwb:
142 case kDecoderPCM16Bwb_2ch: 142 case NetEqDecoder::kDecoderPCM16Bwb_2ch:
143 #ifdef WEBRTC_CODEC_G722 143 #ifdef WEBRTC_CODEC_G722
144 case kDecoderG722: 144 case NetEqDecoder::kDecoderG722:
145 case kDecoderG722_2ch: 145 case NetEqDecoder::kDecoderG722_2ch:
146 #endif 146 #endif
147 case kDecoderCNGwb: { 147 case NetEqDecoder::kDecoderCNGwb: {
148 return 16000; 148 return 16000;
149 } 149 }
150 #ifdef WEBRTC_CODEC_ISAC 150 #ifdef WEBRTC_CODEC_ISAC
151 case kDecoderISACswb: 151 case NetEqDecoder::kDecoderISACswb:
152 #endif 152 #endif
153 case kDecoderPCM16Bswb32kHz: 153 case NetEqDecoder::kDecoderPCM16Bswb32kHz:
154 case kDecoderPCM16Bswb32kHz_2ch: 154 case NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch:
155 case kDecoderCNGswb32kHz: { 155 case NetEqDecoder::kDecoderCNGswb32kHz: {
156 return 32000; 156 return 32000;
157 } 157 }
158 case kDecoderPCM16Bswb48kHz: 158 case NetEqDecoder::kDecoderPCM16Bswb48kHz:
159 case kDecoderPCM16Bswb48kHz_2ch: { 159 case NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch: {
160 return 48000; 160 return 48000;
161 } 161 }
162 #ifdef WEBRTC_CODEC_OPUS 162 #ifdef WEBRTC_CODEC_OPUS
163 case kDecoderOpus: 163 case NetEqDecoder::kDecoderOpus:
164 case kDecoderOpus_2ch: { 164 case NetEqDecoder::kDecoderOpus_2ch: {
165 return 48000; 165 return 48000;
166 } 166 }
167 #endif 167 #endif
168 case kDecoderCNGswb48kHz: { 168 case NetEqDecoder::kDecoderCNGswb48kHz: {
169 // TODO(tlegrand): Remove limitation once ACM has full 48 kHz support. 169 // TODO(tlegrand): Remove limitation once ACM has full 48 kHz support.
170 return 32000; 170 return 32000;
171 } 171 }
172 default: { 172 default: {
173 return -1; // Undefined sample rate. 173 return -1; // Undefined sample rate.
174 } 174 }
175 } 175 }
176 } 176 }
177 177
178 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type) { 178 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type) {
179 if (!CodecSupported(codec_type)) { 179 if (!CodecSupported(codec_type)) {
180 return NULL; 180 return NULL;
181 } 181 }
182 switch (codec_type) { 182 switch (codec_type) {
183 case kDecoderPCMu: 183 case NetEqDecoder::kDecoderPCMu:
184 return new AudioDecoderPcmU(1); 184 return new AudioDecoderPcmU(1);
185 case kDecoderPCMa: 185 case NetEqDecoder::kDecoderPCMa:
186 return new AudioDecoderPcmA(1); 186 return new AudioDecoderPcmA(1);
187 case kDecoderPCMu_2ch: 187 case NetEqDecoder::kDecoderPCMu_2ch:
188 return new AudioDecoderPcmU(2); 188 return new AudioDecoderPcmU(2);
189 case kDecoderPCMa_2ch: 189 case NetEqDecoder::kDecoderPCMa_2ch:
190 return new AudioDecoderPcmA(2); 190 return new AudioDecoderPcmA(2);
191 #ifdef WEBRTC_CODEC_ILBC 191 #ifdef WEBRTC_CODEC_ILBC
192 case kDecoderILBC: 192 case NetEqDecoder::kDecoderILBC:
193 return new AudioDecoderIlbc; 193 return new AudioDecoderIlbc;
194 #endif 194 #endif
195 #if defined(WEBRTC_CODEC_ISACFX) 195 #if defined(WEBRTC_CODEC_ISACFX)
196 case kDecoderISAC: 196 case NetEqDecoder::kDecoderISAC:
197 return new AudioDecoderIsacFix(); 197 return new AudioDecoderIsacFix();
198 #elif defined(WEBRTC_CODEC_ISAC) 198 #elif defined(WEBRTC_CODEC_ISAC)
199 case kDecoderISAC: 199 case NetEqDecoder::kDecoderISAC:
200 case kDecoderISACswb: 200 case NetEqDecoder::kDecoderISACswb:
201 return new AudioDecoderIsac(); 201 return new AudioDecoderIsac();
202 #endif 202 #endif
203 case kDecoderPCM16B: 203 case NetEqDecoder::kDecoderPCM16B:
204 case kDecoderPCM16Bwb: 204 case NetEqDecoder::kDecoderPCM16Bwb:
205 case kDecoderPCM16Bswb32kHz: 205 case NetEqDecoder::kDecoderPCM16Bswb32kHz:
206 case kDecoderPCM16Bswb48kHz: 206 case NetEqDecoder::kDecoderPCM16Bswb48kHz:
207 return new AudioDecoderPcm16B(1); 207 return new AudioDecoderPcm16B(1);
208 case kDecoderPCM16B_2ch: 208 case NetEqDecoder::kDecoderPCM16B_2ch:
209 case kDecoderPCM16Bwb_2ch: 209 case NetEqDecoder::kDecoderPCM16Bwb_2ch:
210 case kDecoderPCM16Bswb32kHz_2ch: 210 case NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch:
211 case kDecoderPCM16Bswb48kHz_2ch: 211 case NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch:
212 return new AudioDecoderPcm16B(2); 212 return new AudioDecoderPcm16B(2);
213 case kDecoderPCM16B_5ch: 213 case NetEqDecoder::kDecoderPCM16B_5ch:
214 return new AudioDecoderPcm16B(5); 214 return new AudioDecoderPcm16B(5);
215 #ifdef WEBRTC_CODEC_G722 215 #ifdef WEBRTC_CODEC_G722
216 case kDecoderG722: 216 case NetEqDecoder::kDecoderG722:
217 return new AudioDecoderG722; 217 return new AudioDecoderG722;
218 case kDecoderG722_2ch: 218 case NetEqDecoder::kDecoderG722_2ch:
219 return new AudioDecoderG722Stereo; 219 return new AudioDecoderG722Stereo;
220 #endif 220 #endif
221 #ifdef WEBRTC_CODEC_OPUS 221 #ifdef WEBRTC_CODEC_OPUS
222 case kDecoderOpus: 222 case NetEqDecoder::kDecoderOpus:
223 return new AudioDecoderOpus(1); 223 return new AudioDecoderOpus(1);
224 case kDecoderOpus_2ch: 224 case NetEqDecoder::kDecoderOpus_2ch:
225 return new AudioDecoderOpus(2); 225 return new AudioDecoderOpus(2);
226 #endif 226 #endif
227 case kDecoderCNGnb: 227 case NetEqDecoder::kDecoderCNGnb:
228 case kDecoderCNGwb: 228 case NetEqDecoder::kDecoderCNGwb:
229 case kDecoderCNGswb32kHz: 229 case NetEqDecoder::kDecoderCNGswb32kHz:
230 case kDecoderCNGswb48kHz: 230 case NetEqDecoder::kDecoderCNGswb48kHz:
231 return new AudioDecoderCng; 231 return new AudioDecoderCng;
232 case kDecoderRED: 232 case NetEqDecoder::kDecoderRED:
233 case kDecoderAVT: 233 case NetEqDecoder::kDecoderAVT:
234 case kDecoderArbitrary: 234 case NetEqDecoder::kDecoderArbitrary:
235 default: { 235 default: {
236 return NULL; 236 return NULL;
237 } 237 }
238 } 238 }
239 } 239 }
240 240
241 } // namespace webrtc 241 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/audio_decoder_impl.h ('k') | webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698