| 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 | 14 |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h" | |
| 17 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h" | 16 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h" |
| 18 #ifdef WEBRTC_CODEC_G722 | 17 #ifdef WEBRTC_CODEC_G722 |
| 19 #include "webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h" | 18 #include "webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h" |
| 20 #endif | 19 #endif |
| 21 #ifdef WEBRTC_CODEC_ILBC | 20 #ifdef WEBRTC_CODEC_ILBC |
| 22 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h" | 21 #include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h" |
| 23 #endif | 22 #endif |
| 24 #ifdef WEBRTC_CODEC_ISACFX | 23 #ifdef WEBRTC_CODEC_ISACFX |
| 25 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isac
fix.h" | 24 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isac
fix.h" |
| 26 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isac
fix.h" | 25 #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isac
fix.h" |
| 27 #endif | 26 #endif |
| 28 #ifdef WEBRTC_CODEC_ISAC | 27 #ifdef WEBRTC_CODEC_ISAC |
| 29 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isa
c.h" | 28 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isa
c.h" |
| 30 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa
c.h" | 29 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa
c.h" |
| 31 #endif | 30 #endif |
| 32 #ifdef WEBRTC_CODEC_OPUS | 31 #ifdef WEBRTC_CODEC_OPUS |
| 33 #include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h" | 32 #include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h" |
| 34 #endif | 33 #endif |
| 35 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h" | 34 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_decoder_pcm16b.h" |
| 36 | 35 |
| 37 namespace webrtc { | 36 namespace webrtc { |
| 38 | 37 |
| 39 AudioDecoderCng::AudioDecoderCng() { | |
| 40 RTC_CHECK_EQ(0, WebRtcCng_CreateDec(&dec_state_)); | |
| 41 WebRtcCng_InitDec(dec_state_); | |
| 42 } | |
| 43 | |
| 44 AudioDecoderCng::~AudioDecoderCng() { | |
| 45 WebRtcCng_FreeDec(dec_state_); | |
| 46 } | |
| 47 | |
| 48 void AudioDecoderCng::Reset() { | |
| 49 WebRtcCng_InitDec(dec_state_); | |
| 50 } | |
| 51 | |
| 52 int AudioDecoderCng::IncomingPacket(const uint8_t* payload, | |
| 53 size_t payload_len, | |
| 54 uint16_t rtp_sequence_number, | |
| 55 uint32_t rtp_timestamp, | |
| 56 uint32_t arrival_timestamp) { | |
| 57 return -1; | |
| 58 } | |
| 59 | |
| 60 CNG_dec_inst* AudioDecoderCng::CngDecoderInstance() { | |
| 61 return dec_state_; | |
| 62 } | |
| 63 | |
| 64 size_t AudioDecoderCng::Channels() const { | |
| 65 return 1; | |
| 66 } | |
| 67 | |
| 68 int AudioDecoderCng::DecodeInternal(const uint8_t* encoded, | |
| 69 size_t encoded_len, | |
| 70 int sample_rate_hz, | |
| 71 int16_t* decoded, | |
| 72 SpeechType* speech_type) { | |
| 73 return -1; | |
| 74 } | |
| 75 | |
| 76 bool CodecSupported(NetEqDecoder codec_type) { | 38 bool CodecSupported(NetEqDecoder codec_type) { |
| 77 switch (codec_type) { | 39 switch (codec_type) { |
| 78 case NetEqDecoder::kDecoderPCMu: | 40 case NetEqDecoder::kDecoderPCMu: |
| 79 case NetEqDecoder::kDecoderPCMa: | 41 case NetEqDecoder::kDecoderPCMa: |
| 80 case NetEqDecoder::kDecoderPCMu_2ch: | 42 case NetEqDecoder::kDecoderPCMu_2ch: |
| 81 case NetEqDecoder::kDecoderPCMa_2ch: | 43 case NetEqDecoder::kDecoderPCMa_2ch: |
| 82 #ifdef WEBRTC_CODEC_ILBC | 44 #ifdef WEBRTC_CODEC_ILBC |
| 83 case NetEqDecoder::kDecoderILBC: | 45 case NetEqDecoder::kDecoderILBC: |
| 84 #endif | 46 #endif |
| 85 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC) | 47 #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 #ifdef WEBRTC_CODEC_OPUS | 183 #ifdef WEBRTC_CODEC_OPUS |
| 222 case NetEqDecoder::kDecoderOpus: | 184 case NetEqDecoder::kDecoderOpus: |
| 223 return new AudioDecoderOpus(1); | 185 return new AudioDecoderOpus(1); |
| 224 case NetEqDecoder::kDecoderOpus_2ch: | 186 case NetEqDecoder::kDecoderOpus_2ch: |
| 225 return new AudioDecoderOpus(2); | 187 return new AudioDecoderOpus(2); |
| 226 #endif | 188 #endif |
| 227 case NetEqDecoder::kDecoderCNGnb: | 189 case NetEqDecoder::kDecoderCNGnb: |
| 228 case NetEqDecoder::kDecoderCNGwb: | 190 case NetEqDecoder::kDecoderCNGwb: |
| 229 case NetEqDecoder::kDecoderCNGswb32kHz: | 191 case NetEqDecoder::kDecoderCNGswb32kHz: |
| 230 case NetEqDecoder::kDecoderCNGswb48kHz: | 192 case NetEqDecoder::kDecoderCNGswb48kHz: |
| 231 return new AudioDecoderCng; | 193 RTC_CHECK(false) << "CNG should not be created like this anymore!"; |
| 232 case NetEqDecoder::kDecoderRED: | 194 case NetEqDecoder::kDecoderRED: |
| 233 case NetEqDecoder::kDecoderAVT: | 195 case NetEqDecoder::kDecoderAVT: |
| 234 case NetEqDecoder::kDecoderArbitrary: | 196 case NetEqDecoder::kDecoderArbitrary: |
| 235 default: { | 197 default: { |
| 236 return NULL; | 198 return NULL; |
| 237 } | 199 } |
| 238 } | 200 } |
| 239 } | 201 } |
| 240 | 202 |
| 241 } // namespace webrtc | 203 } // namespace webrtc |
| OLD | NEW |