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