| 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 23 matching lines...) Expand all Loading... |
| 34 AudioDecoder() = default; | 34 AudioDecoder() = default; |
| 35 virtual ~AudioDecoder() = default; | 35 virtual ~AudioDecoder() = default; |
| 36 | 36 |
| 37 // Decodes |encode_len| bytes from |encoded| and writes the result in | 37 // Decodes |encode_len| bytes from |encoded| and writes the result in |
| 38 // |decoded|. The maximum bytes allowed to be written into |decoded| is | 38 // |decoded|. The maximum bytes allowed to be written into |decoded| is |
| 39 // |max_decoded_bytes|. Returns the total number of samples across all | 39 // |max_decoded_bytes|. Returns the total number of samples across all |
| 40 // channels. If the decoder produced comfort noise, |speech_type| | 40 // channels. If the decoder produced comfort noise, |speech_type| |
| 41 // is set to kComfortNoise, otherwise it is kSpeech. The desired output | 41 // is set to kComfortNoise, otherwise it is kSpeech. The desired output |
| 42 // sample rate is provided in |sample_rate_hz|, which must be valid for the | 42 // sample rate is provided in |sample_rate_hz|, which must be valid for the |
| 43 // codec at hand. | 43 // codec at hand. |
| 44 virtual int Decode(const uint8_t* encoded, | 44 int Decode(const uint8_t* encoded, |
| 45 size_t encoded_len, | 45 size_t encoded_len, |
| 46 int sample_rate_hz, | 46 int sample_rate_hz, |
| 47 size_t max_decoded_bytes, | 47 size_t max_decoded_bytes, |
| 48 int16_t* decoded, | 48 int16_t* decoded, |
| 49 SpeechType* speech_type); | 49 SpeechType* speech_type); |
| 50 | 50 |
| 51 // Same as Decode(), but interfaces to the decoders redundant decode function. | 51 // Same as Decode(), but interfaces to the decoders redundant decode function. |
| 52 // The default implementation simply calls the regular Decode() method. | 52 // The default implementation simply calls the regular Decode() method. |
| 53 virtual int DecodeRedundant(const uint8_t* encoded, | 53 int DecodeRedundant(const uint8_t* encoded, |
| 54 size_t encoded_len, | 54 size_t encoded_len, |
| 55 int sample_rate_hz, | 55 int sample_rate_hz, |
| 56 size_t max_decoded_bytes, | 56 size_t max_decoded_bytes, |
| 57 int16_t* decoded, | 57 int16_t* decoded, |
| 58 SpeechType* speech_type); | 58 SpeechType* speech_type); |
| 59 | 59 |
| 60 // Indicates if the decoder implements the DecodePlc method. | 60 // Indicates if the decoder implements the DecodePlc method. |
| 61 virtual bool HasDecodePlc() const; | 61 virtual bool HasDecodePlc() const; |
| 62 | 62 |
| 63 // Calls the packet-loss concealment of the decoder to update the state after | 63 // Calls the packet-loss concealment of the decoder to update the state after |
| 64 // one or several lost packets. The caller has to make sure that the | 64 // one or several lost packets. The caller has to make sure that the |
| 65 // memory allocated in |decoded| should accommodate |num_frames| frames. | 65 // memory allocated in |decoded| should accommodate |num_frames| frames. |
| 66 virtual size_t DecodePlc(size_t num_frames, int16_t* decoded); | 66 virtual size_t DecodePlc(size_t num_frames, int16_t* decoded); |
| 67 | 67 |
| 68 // Resets the decoder state (empty buffers etc.). | 68 // Resets the decoder state (empty buffers etc.). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 virtual size_t Channels() const = 0; | 101 virtual size_t Channels() const = 0; |
| 102 | 102 |
| 103 protected: | 103 protected: |
| 104 static SpeechType ConvertSpeechType(int16_t type); | 104 static SpeechType ConvertSpeechType(int16_t type); |
| 105 | 105 |
| 106 virtual int DecodeInternal(const uint8_t* encoded, | 106 virtual int DecodeInternal(const uint8_t* encoded, |
| 107 size_t encoded_len, | 107 size_t encoded_len, |
| 108 int sample_rate_hz, | 108 int sample_rate_hz, |
| 109 int16_t* decoded, | 109 int16_t* decoded, |
| 110 SpeechType* speech_type); | 110 SpeechType* speech_type) = 0; |
| 111 | 111 |
| 112 virtual int DecodeRedundantInternal(const uint8_t* encoded, | 112 virtual int DecodeRedundantInternal(const uint8_t* encoded, |
| 113 size_t encoded_len, | 113 size_t encoded_len, |
| 114 int sample_rate_hz, | 114 int sample_rate_hz, |
| 115 int16_t* decoded, | 115 int16_t* decoded, |
| 116 SpeechType* speech_type); | 116 SpeechType* speech_type); |
| 117 | 117 |
| 118 private: | 118 private: |
| 119 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); | 119 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoder); |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 } // namespace webrtc | 122 } // namespace webrtc |
| 123 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ | 123 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_AUDIO_DECODER_H_ |
| OLD | NEW |