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 | |
28 #include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h" | |
29 #endif | |
30 #include "webrtc/typedefs.h" | 27 #include "webrtc/typedefs.h" |
31 | 28 |
32 namespace webrtc { | 29 namespace webrtc { |
33 | 30 |
34 class AudioDecoderPcmU : public AudioDecoder { | 31 class AudioDecoderPcmU : public AudioDecoder { |
35 public: | 32 public: |
36 AudioDecoderPcmU() {} | 33 AudioDecoderPcmU() {} |
37 void Reset() override; | 34 void Reset() override; |
38 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | 35 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; |
39 size_t Channels() const override; | 36 size_t Channels() const override; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 class AudioDecoderPcm16BMultiCh : public AudioDecoderPcm16B { | 116 class AudioDecoderPcm16BMultiCh : public AudioDecoderPcm16B { |
120 public: | 117 public: |
121 explicit AudioDecoderPcm16BMultiCh(size_t num_channels); | 118 explicit AudioDecoderPcm16BMultiCh(size_t num_channels); |
122 size_t Channels() const override; | 119 size_t Channels() const override; |
123 | 120 |
124 private: | 121 private: |
125 const size_t channels_; | 122 const size_t channels_; |
126 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcm16BMultiCh); | 123 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcm16BMultiCh); |
127 }; | 124 }; |
128 | 125 |
129 #ifdef WEBRTC_CODEC_ILBC | |
130 class AudioDecoderIlbc : public AudioDecoder { | |
131 public: | |
132 AudioDecoderIlbc(); | |
133 ~AudioDecoderIlbc() override; | |
134 bool HasDecodePlc() const override; | |
135 size_t DecodePlc(size_t num_frames, int16_t* decoded) override; | |
136 void Reset() override; | |
137 size_t Channels() const override; | |
138 | |
139 protected: | |
140 int DecodeInternal(const uint8_t* encoded, | |
141 size_t encoded_len, | |
142 int sample_rate_hz, | |
143 int16_t* decoded, | |
144 SpeechType* speech_type) override; | |
145 | |
146 private: | |
147 IlbcDecoderInstance* dec_state_; | |
148 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIlbc); | |
149 }; | |
150 #endif | |
151 | |
152 #ifdef WEBRTC_CODEC_G722 | 126 #ifdef WEBRTC_CODEC_G722 |
153 class AudioDecoderG722 : public AudioDecoder { | 127 class AudioDecoderG722 : public AudioDecoder { |
154 public: | 128 public: |
155 AudioDecoderG722(); | 129 AudioDecoderG722(); |
156 ~AudioDecoderG722() override; | 130 ~AudioDecoderG722() override; |
157 bool HasDecodePlc() const override; | 131 bool HasDecodePlc() const override; |
158 void Reset() override; | 132 void Reset() override; |
159 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | 133 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; |
160 size_t Channels() const override; | 134 size_t Channels() const override; |
161 | 135 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // Returns the sample rate for |codec_type|. | 244 // Returns the sample rate for |codec_type|. |
271 int CodecSampleRateHz(NetEqDecoder codec_type); | 245 int CodecSampleRateHz(NetEqDecoder codec_type); |
272 | 246 |
273 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for | 247 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for |
274 // unsupported codecs, and when creating an AudioDecoder is not applicable | 248 // unsupported codecs, and when creating an AudioDecoder is not applicable |
275 // (e.g., for RED and DTMF/AVT types). | 249 // (e.g., for RED and DTMF/AVT types). |
276 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); | 250 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); |
277 | 251 |
278 } // namespace webrtc | 252 } // namespace webrtc |
279 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ | 253 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ |
OLD | NEW |