| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 size_t AudioDecoderPcm16B::Channels() const { | 22 size_t AudioDecoderPcm16B::Channels() const { |
| 23 return 1; | 23 return 1; |
| 24 } | 24 } |
| 25 | 25 |
| 26 int AudioDecoderPcm16B::DecodeInternal(const uint8_t* encoded, | 26 int AudioDecoderPcm16B::DecodeInternal(const uint8_t* encoded, |
| 27 size_t encoded_len, | 27 size_t encoded_len, |
| 28 int sample_rate_hz, | 28 int sample_rate_hz, |
| 29 int16_t* decoded, | 29 int16_t* decoded, |
| 30 SpeechType* speech_type) { | 30 SpeechType* speech_type) { |
| 31 DCHECK(sample_rate_hz == 8000 || sample_rate_hz == 16000 || | 31 RTC_DCHECK(sample_rate_hz == 8000 || sample_rate_hz == 16000 || |
| 32 sample_rate_hz == 32000 || sample_rate_hz == 48000) | 32 sample_rate_hz == 32000 || sample_rate_hz == 48000) |
| 33 << "Unsupported sample rate " << sample_rate_hz; | 33 << "Unsupported sample rate " << sample_rate_hz; |
| 34 size_t ret = WebRtcPcm16b_Decode(encoded, encoded_len, decoded); | 34 size_t ret = WebRtcPcm16b_Decode(encoded, encoded_len, decoded); |
| 35 *speech_type = ConvertSpeechType(1); | 35 *speech_type = ConvertSpeechType(1); |
| 36 return static_cast<int>(ret); | 36 return static_cast<int>(ret); |
| 37 } | 37 } |
| 38 | 38 |
| 39 int AudioDecoderPcm16B::PacketDuration(const uint8_t* encoded, | 39 int AudioDecoderPcm16B::PacketDuration(const uint8_t* encoded, |
| 40 size_t encoded_len) const { | 40 size_t encoded_len) const { |
| 41 // Two encoded byte per sample per channel. | 41 // Two encoded byte per sample per channel. |
| 42 return static_cast<int>(encoded_len / (2 * Channels())); | 42 return static_cast<int>(encoded_len / (2 * Channels())); |
| 43 } | 43 } |
| 44 | 44 |
| 45 AudioDecoderPcm16BMultiCh::AudioDecoderPcm16BMultiCh(size_t num_channels) | 45 AudioDecoderPcm16BMultiCh::AudioDecoderPcm16BMultiCh(size_t num_channels) |
| 46 : channels_(num_channels) { | 46 : channels_(num_channels) { |
| 47 DCHECK(num_channels > 0); | 47 RTC_DCHECK(num_channels > 0); |
| 48 } | 48 } |
| 49 | 49 |
| 50 size_t AudioDecoderPcm16BMultiCh::Channels() const { | 50 size_t AudioDecoderPcm16BMultiCh::Channels() const { |
| 51 return channels_; | 51 return channels_; |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace webrtc | 54 } // namespace webrtc |
| OLD | NEW |