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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // |encoded| which is |encoded_len| bytes long. Returns kNotImplemented if no | 86 // |encoded| which is |encoded_len| bytes long. Returns kNotImplemented if no |
87 // duration estimate is available, or -1 in case of an error. | 87 // duration estimate is available, or -1 in case of an error. |
88 virtual int PacketDurationRedundant(const uint8_t* encoded, | 88 virtual int PacketDurationRedundant(const uint8_t* encoded, |
89 size_t encoded_len) const; | 89 size_t encoded_len) const; |
90 | 90 |
91 // Detects whether a packet has forward error correction. The packet is | 91 // Detects whether a packet has forward error correction. The packet is |
92 // 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. |
93 // Returns true if the packet has FEC and false otherwise. | 93 // Returns true if the packet has FEC and false otherwise. |
94 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; |
95 | 95 |
96 // Returns the actual sample rate of the decoder's output. | 96 // Returns the actual sample rate of the decoder's output. This value may not |
| 97 // change during the lifetime of the decoder. |
97 // NOTE: For now, this has a default implementation that returns an unusable | 98 // NOTE: For now, this has a default implementation that returns an unusable |
98 // value (-1). That default implementation will go away soon, and at the same | 99 // value (-1). That default implementation will go away soon, and at the same |
99 // time callers will start relying on the return value, so make sure you | 100 // time callers will start relying on the return value, so make sure you |
100 // override it with something that returns a correct value! | 101 // override it with something that returns a correct value! |
101 // TODO(kwiberg): Remove the default implementation. | 102 // TODO(kwiberg): Remove the default implementation. |
102 virtual int SampleRateHz() const; | 103 virtual int SampleRateHz() const; |
103 | 104 |
| 105 // The number of channels in the decoder's output. This value may not change |
| 106 // during the lifetime of the decoder. |
104 virtual size_t Channels() const = 0; | 107 virtual size_t Channels() const = 0; |
105 | 108 |
106 protected: | 109 protected: |
107 static SpeechType ConvertSpeechType(int16_t type); | 110 static SpeechType ConvertSpeechType(int16_t type); |
108 | 111 |
109 virtual int DecodeInternal(const uint8_t* encoded, | 112 virtual int DecodeInternal(const uint8_t* encoded, |
110 size_t encoded_len, | 113 size_t encoded_len, |
111 int sample_rate_hz, | 114 int sample_rate_hz, |
112 int16_t* decoded, | 115 int16_t* decoded, |
113 SpeechType* speech_type) = 0; | 116 SpeechType* speech_type) = 0; |
114 | 117 |
115 virtual int DecodeRedundantInternal(const uint8_t* encoded, | 118 virtual int DecodeRedundantInternal(const uint8_t* encoded, |
116 size_t encoded_len, | 119 size_t encoded_len, |
117 int sample_rate_hz, | 120 int sample_rate_hz, |
118 int16_t* decoded, | 121 int16_t* decoded, |
119 SpeechType* speech_type); | 122 SpeechType* speech_type); |
120 | 123 |
121 private: | 124 private: |
122 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); | 125 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); |
123 }; | 126 }; |
124 | 127 |
125 } // namespace webrtc | 128 } // namespace webrtc |
126 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ | 129 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ |
OLD | NEW |