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. |
| 97 // 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 // time callers will start relying on the return value, so make sure you |
| 100 // override it with something that returns a correct value! |
| 101 virtual int SampleRateHz() const; |
| 102 |
96 virtual size_t Channels() const = 0; | 103 virtual size_t Channels() const = 0; |
97 | 104 |
98 protected: | 105 protected: |
99 static SpeechType ConvertSpeechType(int16_t type); | 106 static SpeechType ConvertSpeechType(int16_t type); |
100 | 107 |
101 virtual int DecodeInternal(const uint8_t* encoded, | 108 virtual int DecodeInternal(const uint8_t* encoded, |
102 size_t encoded_len, | 109 size_t encoded_len, |
103 int sample_rate_hz, | 110 int sample_rate_hz, |
104 int16_t* decoded, | 111 int16_t* decoded, |
105 SpeechType* speech_type) = 0; | 112 SpeechType* speech_type) = 0; |
106 | 113 |
107 virtual int DecodeRedundantInternal(const uint8_t* encoded, | 114 virtual int DecodeRedundantInternal(const uint8_t* encoded, |
108 size_t encoded_len, | 115 size_t encoded_len, |
109 int sample_rate_hz, | 116 int sample_rate_hz, |
110 int16_t* decoded, | 117 int16_t* decoded, |
111 SpeechType* speech_type); | 118 SpeechType* speech_type); |
112 | 119 |
113 private: | 120 private: |
114 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); | 121 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); |
115 }; | 122 }; |
116 | 123 |
117 } // namespace webrtc | 124 } // namespace webrtc |
118 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ | 125 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ |
OLD | NEW |