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 26 matching lines...) Expand all Loading... |
37 AudioDecoderIsacT<T>::~AudioDecoderIsacT() { | 37 AudioDecoderIsacT<T>::~AudioDecoderIsacT() { |
38 RTC_CHECK_EQ(0, T::Free(isac_state_)); | 38 RTC_CHECK_EQ(0, T::Free(isac_state_)); |
39 } | 39 } |
40 | 40 |
41 template <typename T> | 41 template <typename T> |
42 int AudioDecoderIsacT<T>::DecodeInternal(const uint8_t* encoded, | 42 int AudioDecoderIsacT<T>::DecodeInternal(const uint8_t* encoded, |
43 size_t encoded_len, | 43 size_t encoded_len, |
44 int sample_rate_hz, | 44 int sample_rate_hz, |
45 int16_t* decoded, | 45 int16_t* decoded, |
46 SpeechType* speech_type) { | 46 SpeechType* speech_type) { |
47 // We want to crate the illusion that iSAC supports 48000 Hz decoding, while | |
48 // in fact it outputs 32000 Hz. This is the iSAC fullband mode. | |
49 if (sample_rate_hz == 48000) | |
50 sample_rate_hz = 32000; | |
51 RTC_CHECK(sample_rate_hz == 16000 || sample_rate_hz == 32000) | 47 RTC_CHECK(sample_rate_hz == 16000 || sample_rate_hz == 32000) |
52 << "Unsupported sample rate " << sample_rate_hz; | 48 << "Unsupported sample rate " << sample_rate_hz; |
53 if (sample_rate_hz != decoder_sample_rate_hz_) { | 49 if (sample_rate_hz != decoder_sample_rate_hz_) { |
54 RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, sample_rate_hz)); | 50 RTC_CHECK_EQ(0, T::SetDecSampRate(isac_state_, sample_rate_hz)); |
55 decoder_sample_rate_hz_ = sample_rate_hz; | 51 decoder_sample_rate_hz_ = sample_rate_hz; |
56 } | 52 } |
57 int16_t temp_type = 1; // Default is speech. | 53 int16_t temp_type = 1; // Default is speech. |
58 int ret = | 54 int ret = |
59 T::DecodeInternal(isac_state_, encoded, encoded_len, decoded, &temp_type); | 55 T::DecodeInternal(isac_state_, encoded, encoded_len, decoded, &temp_type); |
60 *speech_type = ConvertSpeechType(temp_type); | 56 *speech_type = ConvertSpeechType(temp_type); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 95 } |
100 | 96 |
101 template <typename T> | 97 template <typename T> |
102 size_t AudioDecoderIsacT<T>::Channels() const { | 98 size_t AudioDecoderIsacT<T>::Channels() const { |
103 return 1; | 99 return 1; |
104 } | 100 } |
105 | 101 |
106 } // namespace webrtc | 102 } // namespace webrtc |
107 | 103 |
108 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_IMPL_H_ | 104 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_IMPL_H_ |
OLD | NEW |