| 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_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ |
| 13 | 13 |
| 14 #include <assert.h> | 14 #include <assert.h> |
| 15 | 15 |
| 16 #ifndef AUDIO_DECODER_UNITTEST | 16 #ifndef AUDIO_DECODER_UNITTEST |
| 17 // If this is compiled as a part of the audio_deoder_unittest, the codec | 17 // If this is compiled as a part of the audio_deoder_unittest, the codec |
| 18 // selection is made in the gypi file instead of in engine_configurations.h. | 18 // selection is made in the gypi file instead of in engine_configurations.h. |
| 19 #include "webrtc/engine_configurations.h" | 19 #include "webrtc/engine_configurations.h" |
| 20 #endif | 20 #endif |
| 21 #include "webrtc/base/constructormagic.h" | 21 #include "webrtc/base/constructormagic.h" |
| 22 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | 22 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
| 23 #include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h" | 23 #include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h" |
| 24 #ifdef WEBRTC_CODEC_G722 | 24 #ifdef WEBRTC_CODEC_G722 |
| 25 #include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h" | 25 #include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h" |
| 26 #endif | 26 #endif |
| 27 #ifdef WEBRTC_CODEC_ILBC | 27 #ifdef WEBRTC_CODEC_ILBC |
| 28 #include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h" | 28 #include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h" |
| 29 #endif | 29 #endif |
| 30 #ifdef WEBRTC_CODEC_OPUS | |
| 31 #include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h" | |
| 32 #endif | |
| 33 #include "webrtc/typedefs.h" | 30 #include "webrtc/typedefs.h" |
| 34 | 31 |
| 35 namespace webrtc { | 32 namespace webrtc { |
| 36 | 33 |
| 37 class AudioDecoderPcmU : public AudioDecoder { | 34 class AudioDecoderPcmU : public AudioDecoder { |
| 38 public: | 35 public: |
| 39 AudioDecoderPcmU() {} | 36 AudioDecoderPcmU() {} |
| 40 void Reset() override; | 37 void Reset() override; |
| 41 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | 38 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; |
| 42 size_t Channels() const override; | 39 size_t Channels() const override; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 void SplitStereoPacket(const uint8_t* encoded, size_t encoded_len, | 196 void SplitStereoPacket(const uint8_t* encoded, size_t encoded_len, |
| 200 uint8_t* encoded_deinterleaved); | 197 uint8_t* encoded_deinterleaved); |
| 201 | 198 |
| 202 G722DecInst* dec_state_left_; | 199 G722DecInst* dec_state_left_; |
| 203 G722DecInst* dec_state_right_; | 200 G722DecInst* dec_state_right_; |
| 204 | 201 |
| 205 DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo); | 202 DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo); |
| 206 }; | 203 }; |
| 207 #endif | 204 #endif |
| 208 | 205 |
| 209 #ifdef WEBRTC_CODEC_OPUS | |
| 210 class AudioDecoderOpus : public AudioDecoder { | |
| 211 public: | |
| 212 explicit AudioDecoderOpus(size_t num_channels); | |
| 213 ~AudioDecoderOpus() override; | |
| 214 | |
| 215 void Reset() override; | |
| 216 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | |
| 217 int PacketDurationRedundant(const uint8_t* encoded, | |
| 218 size_t encoded_len) const override; | |
| 219 bool PacketHasFec(const uint8_t* encoded, size_t encoded_len) const override; | |
| 220 size_t Channels() const override; | |
| 221 | |
| 222 protected: | |
| 223 int DecodeInternal(const uint8_t* encoded, | |
| 224 size_t encoded_len, | |
| 225 int sample_rate_hz, | |
| 226 int16_t* decoded, | |
| 227 SpeechType* speech_type) override; | |
| 228 int DecodeRedundantInternal(const uint8_t* encoded, | |
| 229 size_t encoded_len, | |
| 230 int sample_rate_hz, | |
| 231 int16_t* decoded, | |
| 232 SpeechType* speech_type) override; | |
| 233 | |
| 234 private: | |
| 235 OpusDecInst* dec_state_; | |
| 236 const size_t channels_; | |
| 237 DISALLOW_COPY_AND_ASSIGN(AudioDecoderOpus); | |
| 238 }; | |
| 239 #endif | |
| 240 | |
| 241 // AudioDecoderCng is a special type of AudioDecoder. It inherits from | 206 // AudioDecoderCng is a special type of AudioDecoder. It inherits from |
| 242 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods | 207 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods |
| 243 // should be used, except constructor, destructor, and accessors. | 208 // should be used, except constructor, destructor, and accessors. |
| 244 // TODO(hlundin): Consider the possibility to create a super-class to | 209 // TODO(hlundin): Consider the possibility to create a super-class to |
| 245 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a | 210 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a |
| 246 // specific CngDecoder class could both inherit from that class. | 211 // specific CngDecoder class could both inherit from that class. |
| 247 class AudioDecoderCng : public AudioDecoder { | 212 class AudioDecoderCng : public AudioDecoder { |
| 248 public: | 213 public: |
| 249 explicit AudioDecoderCng(); | 214 explicit AudioDecoderCng(); |
| 250 ~AudioDecoderCng() override; | 215 ~AudioDecoderCng() override; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // Returns the sample rate for |codec_type|. | 272 // Returns the sample rate for |codec_type|. |
| 308 int CodecSampleRateHz(NetEqDecoder codec_type); | 273 int CodecSampleRateHz(NetEqDecoder codec_type); |
| 309 | 274 |
| 310 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for | 275 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for |
| 311 // unsupported codecs, and when creating an AudioDecoder is not applicable | 276 // unsupported codecs, and when creating an AudioDecoder is not applicable |
| 312 // (e.g., for RED and DTMF/AVT types). | 277 // (e.g., for RED and DTMF/AVT types). |
| 313 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); | 278 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); |
| 314 | 279 |
| 315 } // namespace webrtc | 280 } // namespace webrtc |
| 316 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ | 281 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ |
| OLD | NEW |