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 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" | 11 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <string.h> // memmove | 14 #include <string.h> // memmove |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 #include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h" | 17 #include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h" |
18 #include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h" | 18 #include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h" |
19 #ifdef WEBRTC_CODEC_G722 | 19 #ifdef WEBRTC_CODEC_G722 |
20 #include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h" | 20 #include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h" |
21 #endif | 21 #endif |
22 #ifdef WEBRTC_CODEC_ILBC | 22 #ifdef WEBRTC_CODEC_ILBC |
23 #include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h" | 23 #include "webrtc/modules/audio_coding/codecs/ilbc/interface/audio_decoder_ilbc.h
" |
24 #endif | 24 #endif |
25 #ifdef WEBRTC_CODEC_ISACFX | 25 #ifdef WEBRTC_CODEC_ISACFX |
26 #include "webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_is
acfix.h" | 26 #include "webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_is
acfix.h" |
27 #endif | 27 #endif |
28 #ifdef WEBRTC_CODEC_ISAC | 28 #ifdef WEBRTC_CODEC_ISAC |
29 #include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_i
sac.h" | 29 #include "webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_i
sac.h" |
30 #endif | 30 #endif |
31 #ifdef WEBRTC_CODEC_OPUS | 31 #ifdef WEBRTC_CODEC_OPUS |
32 #include "webrtc/modules/audio_coding/codecs/opus/interface/audio_decoder_opus.h
" | 32 #include "webrtc/modules/audio_coding/codecs/opus/interface/audio_decoder_opus.h
" |
33 #endif | 33 #endif |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 AudioDecoderPcm16BMultiCh::AudioDecoderPcm16BMultiCh(size_t num_channels) | 126 AudioDecoderPcm16BMultiCh::AudioDecoderPcm16BMultiCh(size_t num_channels) |
127 : channels_(num_channels) { | 127 : channels_(num_channels) { |
128 DCHECK(num_channels > 0); | 128 DCHECK(num_channels > 0); |
129 } | 129 } |
130 | 130 |
131 size_t AudioDecoderPcm16BMultiCh::Channels() const { | 131 size_t AudioDecoderPcm16BMultiCh::Channels() const { |
132 return channels_; | 132 return channels_; |
133 } | 133 } |
134 | 134 |
135 // iLBC | |
136 #ifdef WEBRTC_CODEC_ILBC | |
137 AudioDecoderIlbc::AudioDecoderIlbc() { | |
138 WebRtcIlbcfix_DecoderCreate(&dec_state_); | |
139 WebRtcIlbcfix_Decoderinit30Ms(dec_state_); | |
140 } | |
141 | |
142 AudioDecoderIlbc::~AudioDecoderIlbc() { | |
143 WebRtcIlbcfix_DecoderFree(dec_state_); | |
144 } | |
145 | |
146 bool AudioDecoderIlbc::HasDecodePlc() const { | |
147 return true; | |
148 } | |
149 | |
150 int AudioDecoderIlbc::DecodeInternal(const uint8_t* encoded, | |
151 size_t encoded_len, | |
152 int sample_rate_hz, | |
153 int16_t* decoded, | |
154 SpeechType* speech_type) { | |
155 DCHECK_EQ(sample_rate_hz, 8000); | |
156 int16_t temp_type = 1; // Default is speech. | |
157 int ret = WebRtcIlbcfix_Decode(dec_state_, encoded, encoded_len, decoded, | |
158 &temp_type); | |
159 *speech_type = ConvertSpeechType(temp_type); | |
160 return ret; | |
161 } | |
162 | |
163 size_t AudioDecoderIlbc::DecodePlc(size_t num_frames, int16_t* decoded) { | |
164 return WebRtcIlbcfix_NetEqPlc(dec_state_, decoded, num_frames); | |
165 } | |
166 | |
167 void AudioDecoderIlbc::Reset() { | |
168 WebRtcIlbcfix_Decoderinit30Ms(dec_state_); | |
169 } | |
170 | |
171 size_t AudioDecoderIlbc::Channels() const { | |
172 return 1; | |
173 } | |
174 #endif | |
175 | |
176 // G.722 | 135 // G.722 |
177 #ifdef WEBRTC_CODEC_G722 | 136 #ifdef WEBRTC_CODEC_G722 |
178 AudioDecoderG722::AudioDecoderG722() { | 137 AudioDecoderG722::AudioDecoderG722() { |
179 WebRtcG722_CreateDecoder(&dec_state_); | 138 WebRtcG722_CreateDecoder(&dec_state_); |
180 WebRtcG722_DecoderInit(dec_state_); | 139 WebRtcG722_DecoderInit(dec_state_); |
181 } | 140 } |
182 | 141 |
183 AudioDecoderG722::~AudioDecoderG722() { | 142 AudioDecoderG722::~AudioDecoderG722() { |
184 WebRtcG722_FreeDecoder(dec_state_); | 143 WebRtcG722_FreeDecoder(dec_state_); |
185 } | 144 } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 case kDecoderRED: | 453 case kDecoderRED: |
495 case kDecoderAVT: | 454 case kDecoderAVT: |
496 case kDecoderArbitrary: | 455 case kDecoderArbitrary: |
497 default: { | 456 default: { |
498 return NULL; | 457 return NULL; |
499 } | 458 } |
500 } | 459 } |
501 } | 460 } |
502 | 461 |
503 } // namespace webrtc | 462 } // namespace webrtc |
OLD | NEW |