| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 #include "webrtc/typedefs.h" | 27 #include "webrtc/typedefs.h" |
| 28 | 28 |
| 29 namespace webrtc { | 29 namespace webrtc { |
| 30 | 30 |
| 31 class AudioDecoderPcmU : public AudioDecoder { | |
| 32 public: | |
| 33 AudioDecoderPcmU() {} | |
| 34 void Reset() override; | |
| 35 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | |
| 36 size_t Channels() const override; | |
| 37 | |
| 38 protected: | |
| 39 int DecodeInternal(const uint8_t* encoded, | |
| 40 size_t encoded_len, | |
| 41 int sample_rate_hz, | |
| 42 int16_t* decoded, | |
| 43 SpeechType* speech_type) override; | |
| 44 | |
| 45 private: | |
| 46 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmU); | |
| 47 }; | |
| 48 | |
| 49 class AudioDecoderPcmA : public AudioDecoder { | |
| 50 public: | |
| 51 AudioDecoderPcmA() {} | |
| 52 void Reset() override; | |
| 53 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | |
| 54 size_t Channels() const override; | |
| 55 | |
| 56 protected: | |
| 57 int DecodeInternal(const uint8_t* encoded, | |
| 58 size_t encoded_len, | |
| 59 int sample_rate_hz, | |
| 60 int16_t* decoded, | |
| 61 SpeechType* speech_type) override; | |
| 62 | |
| 63 private: | |
| 64 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmA); | |
| 65 }; | |
| 66 | |
| 67 class AudioDecoderPcmUMultiCh : public AudioDecoderPcmU { | |
| 68 public: | |
| 69 explicit AudioDecoderPcmUMultiCh(size_t channels) | |
| 70 : AudioDecoderPcmU(), channels_(channels) { | |
| 71 assert(channels > 0); | |
| 72 } | |
| 73 size_t Channels() const override; | |
| 74 | |
| 75 private: | |
| 76 const size_t channels_; | |
| 77 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmUMultiCh); | |
| 78 }; | |
| 79 | |
| 80 class AudioDecoderPcmAMultiCh : public AudioDecoderPcmA { | |
| 81 public: | |
| 82 explicit AudioDecoderPcmAMultiCh(size_t channels) | |
| 83 : AudioDecoderPcmA(), channels_(channels) { | |
| 84 assert(channels > 0); | |
| 85 } | |
| 86 size_t Channels() const override; | |
| 87 | |
| 88 private: | |
| 89 const size_t channels_; | |
| 90 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmAMultiCh); | |
| 91 }; | |
| 92 | |
| 93 // AudioDecoderCng is a special type of AudioDecoder. It inherits from | 31 // AudioDecoderCng is a special type of AudioDecoder. It inherits from |
| 94 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods | 32 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods |
| 95 // should be used, except constructor, destructor, and accessors. | 33 // should be used, except constructor, destructor, and accessors. |
| 96 // TODO(hlundin): Consider the possibility to create a super-class to | 34 // TODO(hlundin): Consider the possibility to create a super-class to |
| 97 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a | 35 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a |
| 98 // specific CngDecoder class could both inherit from that class. | 36 // specific CngDecoder class could both inherit from that class. |
| 99 class AudioDecoderCng : public AudioDecoder { | 37 class AudioDecoderCng : public AudioDecoder { |
| 100 public: | 38 public: |
| 101 explicit AudioDecoderCng(); | 39 explicit AudioDecoderCng(); |
| 102 ~AudioDecoderCng() override; | 40 ~AudioDecoderCng() override; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // Returns the sample rate for |codec_type|. | 97 // Returns the sample rate for |codec_type|. |
| 160 int CodecSampleRateHz(NetEqDecoder codec_type); | 98 int CodecSampleRateHz(NetEqDecoder codec_type); |
| 161 | 99 |
| 162 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for | 100 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for |
| 163 // unsupported codecs, and when creating an AudioDecoder is not applicable | 101 // unsupported codecs, and when creating an AudioDecoder is not applicable |
| 164 // (e.g., for RED and DTMF/AVT types). | 102 // (e.g., for RED and DTMF/AVT types). |
| 165 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); | 103 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); |
| 166 | 104 |
| 167 } // namespace webrtc | 105 } // namespace webrtc |
| 168 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ | 106 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ |
| OLD | NEW |