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 // TODO(kwiberg): Remove the default implementation. |
| 102 virtual int SampleRateHz() const; |
| 103 |
96 virtual size_t Channels() const = 0; | 104 virtual size_t Channels() const = 0; |
97 | 105 |
98 protected: | 106 protected: |
99 static SpeechType ConvertSpeechType(int16_t type); | 107 static SpeechType ConvertSpeechType(int16_t type); |
100 | 108 |
101 virtual int DecodeInternal(const uint8_t* encoded, | 109 virtual int DecodeInternal(const uint8_t* encoded, |
102 size_t encoded_len, | 110 size_t encoded_len, |
103 int sample_rate_hz, | 111 int sample_rate_hz, |
104 int16_t* decoded, | 112 int16_t* decoded, |
105 SpeechType* speech_type) = 0; | 113 SpeechType* speech_type) = 0; |
106 | 114 |
107 virtual int DecodeRedundantInternal(const uint8_t* encoded, | 115 virtual int DecodeRedundantInternal(const uint8_t* encoded, |
108 size_t encoded_len, | 116 size_t encoded_len, |
109 int sample_rate_hz, | 117 int sample_rate_hz, |
110 int16_t* decoded, | 118 int16_t* decoded, |
111 SpeechType* speech_type); | 119 SpeechType* speech_type); |
112 | 120 |
113 private: | 121 private: |
114 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); | 122 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); |
115 }; | 123 }; |
116 | 124 |
117 } // namespace webrtc | 125 } // namespace webrtc |
118 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ | 126 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ |
OLD | NEW |