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_INCLUDE_AUDIO_DECODER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ |
13 | 13 |
14 #include <stdlib.h> // NULL | 14 #include <stdlib.h> // NULL |
15 | 15 |
16 #include "webrtc/base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
17 #include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h" | |
18 #include "webrtc/typedefs.h" | 17 #include "webrtc/typedefs.h" |
19 | 18 |
20 namespace webrtc { | 19 namespace webrtc { |
21 | 20 |
22 // This is the interface class for decoders in NetEQ. Each codec type will have | 21 // This is the interface class for decoders in NetEQ. Each codec type will have |
23 // and implementation of this class. | 22 // and implementation of this class. |
24 class AudioDecoder { | 23 class AudioDecoder { |
25 public: | 24 public: |
26 enum SpeechType { | 25 enum SpeechType { |
27 kSpeech = 1, | 26 kSpeech = 1, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // |encoded| which is |encoded_len| bytes long. Returns kNotImplemented if no | 86 // |encoded| which is |encoded_len| bytes long. Returns kNotImplemented if no |
88 // duration estimate is available, or -1 in case of an error. | 87 // duration estimate is available, or -1 in case of an error. |
89 virtual int PacketDurationRedundant(const uint8_t* encoded, | 88 virtual int PacketDurationRedundant(const uint8_t* encoded, |
90 size_t encoded_len) const; | 89 size_t encoded_len) const; |
91 | 90 |
92 // Detects whether a packet has forward error correction. The packet is | 91 // Detects whether a packet has forward error correction. The packet is |
93 // comprised of the samples in |encoded| which is |encoded_len| bytes long. | 92 // comprised of the samples in |encoded| which is |encoded_len| bytes long. |
94 // Returns true if the packet has FEC and false otherwise. | 93 // Returns true if the packet has FEC and false otherwise. |
95 virtual bool PacketHasFec(const uint8_t* encoded, size_t encoded_len) const; | 94 virtual bool PacketHasFec(const uint8_t* encoded, size_t encoded_len) const; |
96 | 95 |
97 // If this is a CNG decoder, return the underlying CNG_dec_inst*. If this | |
98 // isn't a CNG decoder, don't call this method. | |
99 virtual CNG_dec_inst* CngDecoderInstance(); | |
100 | |
101 virtual size_t Channels() const = 0; | 96 virtual size_t Channels() const = 0; |
102 | 97 |
103 protected: | 98 protected: |
104 static SpeechType ConvertSpeechType(int16_t type); | 99 static SpeechType ConvertSpeechType(int16_t type); |
105 | 100 |
106 virtual int DecodeInternal(const uint8_t* encoded, | 101 virtual int DecodeInternal(const uint8_t* encoded, |
107 size_t encoded_len, | 102 size_t encoded_len, |
108 int sample_rate_hz, | 103 int sample_rate_hz, |
109 int16_t* decoded, | 104 int16_t* decoded, |
110 SpeechType* speech_type) = 0; | 105 SpeechType* speech_type) = 0; |
111 | 106 |
112 virtual int DecodeRedundantInternal(const uint8_t* encoded, | 107 virtual int DecodeRedundantInternal(const uint8_t* encoded, |
113 size_t encoded_len, | 108 size_t encoded_len, |
114 int sample_rate_hz, | 109 int sample_rate_hz, |
115 int16_t* decoded, | 110 int16_t* decoded, |
116 SpeechType* speech_type); | 111 SpeechType* speech_type); |
117 | 112 |
118 private: | 113 private: |
119 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); | 114 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); |
120 }; | 115 }; |
121 | 116 |
122 } // namespace webrtc | 117 } // namespace webrtc |
123 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ | 118 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ |
OLD | NEW |