| 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 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_ |
| 13 | 13 |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "webrtc/base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
| 17 #include "webrtc/base/optional.h" | 17 #include "webrtc/base/optional.h" |
| 18 #include "webrtc/base/scoped_ref_ptr.h" | 18 #include "webrtc/base/scoped_ref_ptr.h" |
| 19 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | 19 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
| 20 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" | 20 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" |
| 21 | 21 |
| 22 namespace webrtc { | 22 namespace webrtc { |
| 23 | 23 |
| 24 // TODO(kwiberg): Remove the possibility of not specifying the sample rate at | 24 // TODO(kwiberg): Remove the possibility of not specifying the sample rate at |
| 25 // object creation time. | 25 // object creation time. |
| 26 template <typename T> | 26 template <typename T> |
| 27 class AudioDecoderIsacT final : public AudioDecoder { | 27 class AudioDecoderIsacT final : public AudioDecoder { |
| 28 public: | 28 public: |
| 29 AudioDecoderIsacT(); | |
| 30 explicit AudioDecoderIsacT( | |
| 31 const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo); | |
| 32 explicit AudioDecoderIsacT(int sample_rate_hz); | 29 explicit AudioDecoderIsacT(int sample_rate_hz); |
| 33 AudioDecoderIsacT(int sample_rate_hz, | 30 AudioDecoderIsacT(int sample_rate_hz, |
| 34 const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo); | 31 const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo); |
| 35 ~AudioDecoderIsacT() override; | 32 ~AudioDecoderIsacT() override; |
| 36 | 33 |
| 37 bool HasDecodePlc() const override; | 34 bool HasDecodePlc() const override; |
| 38 size_t DecodePlc(size_t num_frames, int16_t* decoded) override; | 35 size_t DecodePlc(size_t num_frames, int16_t* decoded) override; |
| 39 void Reset() override; | 36 void Reset() override; |
| 40 int IncomingPacket(const uint8_t* payload, | 37 int IncomingPacket(const uint8_t* payload, |
| 41 size_t payload_len, | 38 size_t payload_len, |
| 42 uint16_t rtp_sequence_number, | 39 uint16_t rtp_sequence_number, |
| 43 uint32_t rtp_timestamp, | 40 uint32_t rtp_timestamp, |
| 44 uint32_t arrival_timestamp) override; | 41 uint32_t arrival_timestamp) override; |
| 45 int ErrorCode() override; | 42 int ErrorCode() override; |
| 46 int SampleRateHz() const override; | 43 int SampleRateHz() const override; |
| 47 size_t Channels() const override; | 44 size_t Channels() const override; |
| 48 int DecodeInternal(const uint8_t* encoded, | 45 int DecodeInternal(const uint8_t* encoded, |
| 49 size_t encoded_len, | 46 size_t encoded_len, |
| 50 int sample_rate_hz, | 47 int sample_rate_hz, |
| 51 int16_t* decoded, | 48 int16_t* decoded, |
| 52 SpeechType* speech_type) override; | 49 SpeechType* speech_type) override; |
| 53 | 50 |
| 54 private: | 51 private: |
| 55 AudioDecoderIsacT(rtc::Optional<int> sample_rate_hz, | |
| 56 const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo); | |
| 57 | |
| 58 typename T::instance_type* isac_state_; | 52 typename T::instance_type* isac_state_; |
| 59 rtc::Optional<int> sample_rate_hz_; | 53 int sample_rate_hz_; |
| 60 rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo_; | 54 rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo_; |
| 61 | 55 |
| 62 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacT); | 56 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacT); |
| 63 }; | 57 }; |
| 64 | 58 |
| 65 } // namespace webrtc | 59 } // namespace webrtc |
| 66 | 60 |
| 67 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_ | 61 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_ |
| OLD | NEW |