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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 : AudioDecoderPcmA(), channels_(channels) { | 83 : AudioDecoderPcmA(), channels_(channels) { |
84 assert(channels > 0); | 84 assert(channels > 0); |
85 } | 85 } |
86 size_t Channels() const override; | 86 size_t Channels() const override; |
87 | 87 |
88 private: | 88 private: |
89 const size_t channels_; | 89 const size_t channels_; |
90 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmAMultiCh); | 90 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmAMultiCh); |
91 }; | 91 }; |
92 | 92 |
93 #ifdef WEBRTC_CODEC_G722 | |
94 class AudioDecoderG722 : public AudioDecoder { | |
95 public: | |
96 AudioDecoderG722(); | |
97 ~AudioDecoderG722() override; | |
98 bool HasDecodePlc() const override; | |
99 void Reset() override; | |
100 int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override; | |
101 size_t Channels() const override; | |
102 | |
103 protected: | |
104 int DecodeInternal(const uint8_t* encoded, | |
105 size_t encoded_len, | |
106 int sample_rate_hz, | |
107 int16_t* decoded, | |
108 SpeechType* speech_type) override; | |
109 | |
110 private: | |
111 G722DecInst* dec_state_; | |
112 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722); | |
113 }; | |
114 | |
115 class AudioDecoderG722Stereo : public AudioDecoder { | |
116 public: | |
117 AudioDecoderG722Stereo(); | |
118 ~AudioDecoderG722Stereo() override; | |
119 void Reset() override; | |
120 | |
121 protected: | |
122 int DecodeInternal(const uint8_t* encoded, | |
123 size_t encoded_len, | |
124 int sample_rate_hz, | |
125 int16_t* decoded, | |
126 SpeechType* speech_type) override; | |
127 size_t Channels() const override; | |
128 | |
129 private: | |
130 // Splits the stereo-interleaved payload in |encoded| into separate payloads | |
131 // for left and right channels. The separated payloads are written to | |
132 // |encoded_deinterleaved|, which must hold at least |encoded_len| samples. | |
133 // The left channel starts at offset 0, while the right channel starts at | |
134 // offset encoded_len / 2 into |encoded_deinterleaved|. | |
135 void SplitStereoPacket(const uint8_t* encoded, size_t encoded_len, | |
136 uint8_t* encoded_deinterleaved); | |
137 | |
138 G722DecInst* dec_state_left_; | |
139 G722DecInst* dec_state_right_; | |
140 | |
141 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo); | |
142 }; | |
143 #endif | |
144 | |
145 // AudioDecoderCng is a special type of AudioDecoder. It inherits from | 93 // AudioDecoderCng is a special type of AudioDecoder. It inherits from |
146 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods | 94 // AudioDecoder just to fit in the DecoderDatabase. None of the class methods |
147 // should be used, except constructor, destructor, and accessors. | 95 // should be used, except constructor, destructor, and accessors. |
148 // TODO(hlundin): Consider the possibility to create a super-class to | 96 // TODO(hlundin): Consider the possibility to create a super-class to |
149 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a | 97 // AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a |
150 // specific CngDecoder class could both inherit from that class. | 98 // specific CngDecoder class could both inherit from that class. |
151 class AudioDecoderCng : public AudioDecoder { | 99 class AudioDecoderCng : public AudioDecoder { |
152 public: | 100 public: |
153 explicit AudioDecoderCng(); | 101 explicit AudioDecoderCng(); |
154 ~AudioDecoderCng() override; | 102 ~AudioDecoderCng() override; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // Returns the sample rate for |codec_type|. | 159 // Returns the sample rate for |codec_type|. |
212 int CodecSampleRateHz(NetEqDecoder codec_type); | 160 int CodecSampleRateHz(NetEqDecoder codec_type); |
213 | 161 |
214 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for | 162 // Creates an AudioDecoder object of type |codec_type|. Returns NULL for for |
215 // unsupported codecs, and when creating an AudioDecoder is not applicable | 163 // unsupported codecs, and when creating an AudioDecoder is not applicable |
216 // (e.g., for RED and DTMF/AVT types). | 164 // (e.g., for RED and DTMF/AVT types). |
217 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); | 165 AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type); |
218 | 166 |
219 } // namespace webrtc | 167 } // namespace webrtc |
220 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ | 168 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_ |
OLD | NEW |