Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/audio_decoder_isac_t.h

Issue 2024633002: AudioDecoder: New method SampleRateHz, + implementations for our codecs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add TODO fix PCM A U at 8 kHz Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/scoped_ref_ptr.h" 18 #include "webrtc/base/scoped_ref_ptr.h"
18 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" 19 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
19 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" 20 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
20 21
21 namespace webrtc { 22 namespace webrtc {
22 23
24 // TODO(kwiberg): Remove the possibility of not specifying the sample rate at
25 // object creation time.
23 template <typename T> 26 template <typename T>
24 class AudioDecoderIsacT final : public AudioDecoder { 27 class AudioDecoderIsacT final : public AudioDecoder {
25 public: 28 public:
26 AudioDecoderIsacT(); 29 AudioDecoderIsacT();
27 explicit AudioDecoderIsacT( 30 explicit AudioDecoderIsacT(
28 const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo); 31 const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo);
32 explicit AudioDecoderIsacT(int sample_rate_hz);
33 AudioDecoderIsacT(int sample_rate_hz,
34 const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo);
29 ~AudioDecoderIsacT() override; 35 ~AudioDecoderIsacT() override;
30 36
31 bool HasDecodePlc() const override; 37 bool HasDecodePlc() const override;
32 size_t DecodePlc(size_t num_frames, int16_t* decoded) override; 38 size_t DecodePlc(size_t num_frames, int16_t* decoded) override;
33 void Reset() override; 39 void Reset() override;
34 int IncomingPacket(const uint8_t* payload, 40 int IncomingPacket(const uint8_t* payload,
35 size_t payload_len, 41 size_t payload_len,
36 uint16_t rtp_sequence_number, 42 uint16_t rtp_sequence_number,
37 uint32_t rtp_timestamp, 43 uint32_t rtp_timestamp,
38 uint32_t arrival_timestamp) override; 44 uint32_t arrival_timestamp) override;
39 int ErrorCode() override; 45 int ErrorCode() override;
46 int SampleRateHz() const override;
40 size_t Channels() const override; 47 size_t Channels() const override;
41 int DecodeInternal(const uint8_t* encoded, 48 int DecodeInternal(const uint8_t* encoded,
42 size_t encoded_len, 49 size_t encoded_len,
43 int sample_rate_hz, 50 int sample_rate_hz,
44 int16_t* decoded, 51 int16_t* decoded,
45 SpeechType* speech_type) override; 52 SpeechType* speech_type) override;
46 53
47 private: 54 private:
55 AudioDecoderIsacT(rtc::Optional<int> sample_rate_hz,
56 const rtc::scoped_refptr<LockedIsacBandwidthInfo>& bwinfo);
57
48 typename T::instance_type* isac_state_; 58 typename T::instance_type* isac_state_;
59 rtc::Optional<int> sample_rate_hz_;
49 rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo_; 60 rtc::scoped_refptr<LockedIsacBandwidthInfo> bwinfo_;
50 int decoder_sample_rate_hz_;
51 61
52 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacT); 62 RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacT);
53 }; 63 };
54 64
55 } // namespace webrtc 65 } // namespace webrtc
56 66
57 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_ 67 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_DECODER_ISAC_T_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698