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 19 matching lines...) Expand all Loading... |
30 #ifdef WEBRTC_CODEC_OPUS | 30 #ifdef WEBRTC_CODEC_OPUS |
31 #include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h" | 31 #include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h" |
32 #endif | 32 #endif |
33 #include "webrtc/typedefs.h" | 33 #include "webrtc/typedefs.h" |
34 | 34 |
35 namespace webrtc { | 35 namespace webrtc { |
36 | 36 |
37 class AudioDecoderPcmU : public AudioDecoder { | 37 class AudioDecoderPcmU : public AudioDecoder { |
38 public: | 38 public: |
39 AudioDecoderPcmU() {} | 39 AudioDecoderPcmU() {} |
40 int Init() override; | 40 void Reset() override; |
41 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | 41 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; |
42 size_t Channels() const override; | 42 size_t Channels() const override; |
43 | 43 |
44 protected: | 44 protected: |
45 int DecodeInternal(const uint8_t* encoded, | 45 int DecodeInternal(const uint8_t* encoded, |
46 size_t encoded_len, | 46 size_t encoded_len, |
47 int sample_rate_hz, | 47 int sample_rate_hz, |
48 int16_t* decoded, | 48 int16_t* decoded, |
49 SpeechType* speech_type) override; | 49 SpeechType* speech_type) override; |
50 | 50 |
51 private: | 51 private: |
52 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmU); | 52 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmU); |
53 }; | 53 }; |
54 | 54 |
55 class AudioDecoderPcmA : public AudioDecoder { | 55 class AudioDecoderPcmA : public AudioDecoder { |
56 public: | 56 public: |
57 AudioDecoderPcmA() {} | 57 AudioDecoderPcmA() {} |
58 int Init() override; | 58 void Reset() override; |
59 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | 59 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; |
60 size_t Channels() const override; | 60 size_t Channels() const override; |
61 | 61 |
62 protected: | 62 protected: |
63 int DecodeInternal(const uint8_t* encoded, | 63 int DecodeInternal(const uint8_t* encoded, |
64 size_t encoded_len, | 64 size_t encoded_len, |
65 int sample_rate_hz, | 65 int sample_rate_hz, |
66 int16_t* decoded, | 66 int16_t* decoded, |
67 SpeechType* speech_type) override; | 67 SpeechType* speech_type) override; |
68 | 68 |
(...skipping 26 matching lines...) Expand all Loading... |
95 const size_t channels_; | 95 const size_t channels_; |
96 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmAMultiCh); | 96 DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmAMultiCh); |
97 }; | 97 }; |
98 | 98 |
99 #ifdef WEBRTC_CODEC_PCM16 | 99 #ifdef WEBRTC_CODEC_PCM16 |
100 // This class handles all four types (i.e., sample rates) of PCM16B codecs. | 100 // This class handles all four types (i.e., sample rates) of PCM16B codecs. |
101 // The type is specified in the constructor parameter |type|. | 101 // The type is specified in the constructor parameter |type|. |
102 class AudioDecoderPcm16B : public AudioDecoder { | 102 class AudioDecoderPcm16B : public AudioDecoder { |
103 public: | 103 public: |
104 AudioDecoderPcm16B(); | 104 AudioDecoderPcm16B(); |
105 int Init() override; | 105 void Reset() override; |
106 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | 106 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; |
107 size_t Channels() const override; | 107 size_t Channels() const override; |
108 | 108 |
109 protected: | 109 protected: |
110 int DecodeInternal(const uint8_t* encoded, | 110 int DecodeInternal(const uint8_t* encoded, |
111 size_t encoded_len, | 111 size_t encoded_len, |
112 int sample_rate_hz, | 112 int sample_rate_hz, |
113 int16_t* decoded, | 113 int16_t* decoded, |
114 SpeechType* speech_type) override; | 114 SpeechType* speech_type) override; |
115 | 115 |
(...skipping 15 matching lines...) Expand all Loading... |
131 }; | 131 }; |
132 #endif | 132 #endif |
133 | 133 |
134 #ifdef WEBRTC_CODEC_ILBC | 134 #ifdef WEBRTC_CODEC_ILBC |
135 class AudioDecoderIlbc : public AudioDecoder { | 135 class AudioDecoderIlbc : public AudioDecoder { |
136 public: | 136 public: |
137 AudioDecoderIlbc(); | 137 AudioDecoderIlbc(); |
138 ~AudioDecoderIlbc() override; | 138 ~AudioDecoderIlbc() override; |
139 bool HasDecodePlc() const override; | 139 bool HasDecodePlc() const override; |
140 size_t DecodePlc(size_t num_frames, int16_t* decoded) override; | 140 size_t DecodePlc(size_t num_frames, int16_t* decoded) override; |
141 int Init() override; | 141 void Reset() override; |
142 size_t Channels() const override; | 142 size_t Channels() const override; |
143 | 143 |
144 protected: | 144 protected: |
145 int DecodeInternal(const uint8_t* encoded, | 145 int DecodeInternal(const uint8_t* encoded, |
146 size_t encoded_len, | 146 size_t encoded_len, |
147 int sample_rate_hz, | 147 int sample_rate_hz, |
148 int16_t* decoded, | 148 int16_t* decoded, |
149 SpeechType* speech_type) override; | 149 SpeechType* speech_type) override; |
150 | 150 |
151 private: | 151 private: |
152 IlbcDecoderInstance* dec_state_; | 152 IlbcDecoderInstance* dec_state_; |
153 DISALLOW_COPY_AND_ASSIGN(AudioDecoderIlbc); | 153 DISALLOW_COPY_AND_ASSIGN(AudioDecoderIlbc); |
154 }; | 154 }; |
155 #endif | 155 #endif |
156 | 156 |
157 #ifdef WEBRTC_CODEC_G722 | 157 #ifdef WEBRTC_CODEC_G722 |
158 class AudioDecoderG722 : public AudioDecoder { | 158 class AudioDecoderG722 : public AudioDecoder { |
159 public: | 159 public: |
160 AudioDecoderG722(); | 160 AudioDecoderG722(); |
161 ~AudioDecoderG722() override; | 161 ~AudioDecoderG722() override; |
162 bool HasDecodePlc() const override; | 162 bool HasDecodePlc() const override; |
163 int Init() override; | 163 void Reset() override; |
164 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | 164 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; |
165 size_t Channels() const override; | 165 size_t Channels() const override; |
166 | 166 |
167 protected: | 167 protected: |
168 int DecodeInternal(const uint8_t* encoded, | 168 int DecodeInternal(const uint8_t* encoded, |
169 size_t encoded_len, | 169 size_t encoded_len, |
170 int sample_rate_hz, | 170 int sample_rate_hz, |
171 int16_t* decoded, | 171 int16_t* decoded, |
172 SpeechType* speech_type) override; | 172 SpeechType* speech_type) override; |
173 | 173 |
174 private: | 174 private: |
175 G722DecInst* dec_state_; | 175 G722DecInst* dec_state_; |
176 DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722); | 176 DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722); |
177 }; | 177 }; |
178 | 178 |
179 class AudioDecoderG722Stereo : public AudioDecoder { | 179 class AudioDecoderG722Stereo : public AudioDecoder { |
180 public: | 180 public: |
181 AudioDecoderG722Stereo(); | 181 AudioDecoderG722Stereo(); |
182 ~AudioDecoderG722Stereo() override; | 182 ~AudioDecoderG722Stereo() override; |
183 int Init() override; | 183 void Reset() override; |
184 | 184 |
185 protected: | 185 protected: |
186 int DecodeInternal(const uint8_t* encoded, | 186 int DecodeInternal(const uint8_t* encoded, |
187 size_t encoded_len, | 187 size_t encoded_len, |
188 int sample_rate_hz, | 188 int sample_rate_hz, |
189 int16_t* decoded, | 189 int16_t* decoded, |
190 SpeechType* speech_type) override; | 190 SpeechType* speech_type) override; |
191 size_t Channels() const override; | 191 size_t Channels() const override; |
192 | 192 |
193 private: | 193 private: |
(...skipping 11 matching lines...) Expand all Loading... |
205 DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo); | 205 DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo); |
206 }; | 206 }; |
207 #endif | 207 #endif |
208 | 208 |
209 #ifdef WEBRTC_CODEC_OPUS | 209 #ifdef WEBRTC_CODEC_OPUS |
210 class AudioDecoderOpus : public AudioDecoder { | 210 class AudioDecoderOpus : public AudioDecoder { |
211 public: | 211 public: |
212 explicit AudioDecoderOpus(size_t num_channels); | 212 explicit AudioDecoderOpus(size_t num_channels); |
213 ~AudioDecoderOpus() override; | 213 ~AudioDecoderOpus() override; |
214 | 214 |
215 int Init() override; | 215 void Reset() override; |
216 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | 216 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; |
217 int PacketDurationRedundant(const uint8_t* encoded, | 217 int PacketDurationRedundant(const uint8_t* encoded, |
218 size_t encoded_len) const override; | 218 size_t encoded_len) const override; |
219 bool PacketHasFec(const uint8_t* encoded, 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; | 220 size_t Channels() const override; |
221 | 221 |
222 protected: | 222 protected: |
223 int DecodeInternal(const uint8_t* encoded, | 223 int DecodeInternal(const uint8_t* encoded, |
224 size_t encoded_len, | 224 size_t encoded_len, |
225 int sample_rate_hz, | 225 int sample_rate_hz, |
(...skipping 15 matching lines...) Expand all Loading... |
241 // AudioDecoderCng is a special type of AudioDecoder. It inherits from | 241 // AudioDecoderCng is a special type of AudioDecoder. It inherits from |
242 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods | 242 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods |
243 // should be used, except constructor, destructor, and accessors. | 243 // should be used, except constructor, destructor, and accessors. |
244 // TODO(hlundin): Consider the possibility to create a super-class to | 244 // TODO(hlundin): Consider the possibility to create a super-class to |
245 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a | 245 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a |
246 // specific CngDecoder class could both inherit from that class. | 246 // specific CngDecoder class could both inherit from that class. |
247 class AudioDecoderCng : public AudioDecoder { | 247 class AudioDecoderCng : public AudioDecoder { |
248 public: | 248 public: |
249 explicit AudioDecoderCng(); | 249 explicit AudioDecoderCng(); |
250 ~AudioDecoderCng() override; | 250 ~AudioDecoderCng() override; |
251 int Init() override; | 251 void Reset() override; |
252 int IncomingPacket(const uint8_t* payload, | 252 int IncomingPacket(const uint8_t* payload, |
253 size_t payload_len, | 253 size_t payload_len, |
254 uint16_t rtp_sequence_number, | 254 uint16_t rtp_sequence_number, |
255 uint32_t rtp_timestamp, | 255 uint32_t rtp_timestamp, |
256 uint32_t arrival_timestamp) override; | 256 uint32_t arrival_timestamp) override; |
257 | 257 |
258 CNG_dec_inst* CngDecoderInstance() override; | 258 CNG_dec_inst* CngDecoderInstance() override; |
259 size_t Channels() const override; | 259 size_t Channels() const override; |
260 | 260 |
261 protected: | 261 protected: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // Returns the sample rate for |codec_type|. | 307 // Returns the sample rate for |codec_type|. |
308 int CodecSampleRateHz(NetEqDecoder codec_type); | 308 int CodecSampleRateHz(NetEqDecoder codec_type); |
309 | 309 |
310 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for | 310 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for |
311 // unsupported codecs, and when creating an AudioDecoder is not applicable | 311 // unsupported codecs, and when creating an AudioDecoder is not applicable |
312 // (e.g., for RED and DTMF/AVT types). | 312 // (e.g., for RED and DTMF/AVT types). |
313 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); | 313 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); |
314 | 314 |
315 } // namespace webrtc | 315 } // namespace webrtc |
316 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ | 316 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ |
OLD | NEW |