OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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_ENCODER_ISAC_T_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | 16 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
17 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" | 17 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 struct CodecInst; | 21 struct CodecInst; |
22 | 22 |
23 template <typename T> | 23 template <typename T> |
24 class AudioEncoderIsacT final : public AudioEncoder { | 24 class AudioEncoderIsacT final : public AudioEncoder { |
25 public: | 25 public: |
26 using AudioEncoder::EncodeInternal; | |
27 | |
28 // Allowed combinations of sample rate, frame size, and bit rate are | 26 // Allowed combinations of sample rate, frame size, and bit rate are |
29 // - 16000 Hz, 30 ms, 10000-32000 bps | 27 // - 16000 Hz, 30 ms, 10000-32000 bps |
30 // - 16000 Hz, 60 ms, 10000-32000 bps | 28 // - 16000 Hz, 60 ms, 10000-32000 bps |
31 // - 32000 Hz, 30 ms, 10000-56000 bps (if T has super-wideband support) | 29 // - 32000 Hz, 30 ms, 10000-56000 bps (if T has super-wideband support) |
32 struct Config { | 30 struct Config { |
33 bool IsOk() const; | 31 bool IsOk() const; |
34 | 32 |
35 LockedIsacBandwidthInfo* bwinfo = nullptr; | 33 LockedIsacBandwidthInfo* bwinfo = nullptr; |
36 | 34 |
37 int payload_type = 103; | 35 int payload_type = 103; |
(...skipping 17 matching lines...) Expand all Loading... |
55 explicit AudioEncoderIsacT(const CodecInst& codec_inst, | 53 explicit AudioEncoderIsacT(const CodecInst& codec_inst, |
56 LockedIsacBandwidthInfo* bwinfo); | 54 LockedIsacBandwidthInfo* bwinfo); |
57 ~AudioEncoderIsacT() override; | 55 ~AudioEncoderIsacT() override; |
58 | 56 |
59 size_t MaxEncodedBytes() const override; | 57 size_t MaxEncodedBytes() const override; |
60 int SampleRateHz() const override; | 58 int SampleRateHz() const override; |
61 size_t NumChannels() const override; | 59 size_t NumChannels() const override; |
62 size_t Num10MsFramesInNextPacket() const override; | 60 size_t Num10MsFramesInNextPacket() const override; |
63 size_t Max10MsFramesInAPacket() const override; | 61 size_t Max10MsFramesInAPacket() const override; |
64 int GetTargetBitrate() const override; | 62 int GetTargetBitrate() const override; |
65 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, | 63 EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
66 rtc::ArrayView<const int16_t> audio, | 64 rtc::ArrayView<const int16_t> audio, |
67 rtc::Buffer* encoded) override; | 65 rtc::Buffer* encoded) override; |
68 void Reset() override; | 66 void Reset() override; |
69 | 67 |
70 private: | 68 private: |
71 // This value is taken from STREAM_SIZE_MAX_60 for iSAC float (60 ms) and | 69 // This value is taken from STREAM_SIZE_MAX_60 for iSAC float (60 ms) and |
72 // STREAM_MAXW16_60MS for iSAC fix (60 ms). | 70 // STREAM_MAXW16_60MS for iSAC fix (60 ms). |
73 static const size_t kSufficientEncodeBufferSizeBytes = 400; | 71 static const size_t kSufficientEncodeBufferSizeBytes = 400; |
74 | 72 |
75 static const int kDefaultBitRate = 32000; | 73 static const int kDefaultBitRate = 32000; |
76 | 74 |
77 // Recreate the iSAC encoder instance with the given settings, and save them. | 75 // Recreate the iSAC encoder instance with the given settings, and save them. |
(...skipping 11 matching lines...) Expand all Loading... |
89 | 87 |
90 // Timestamp of the previously encoded packet. | 88 // Timestamp of the previously encoded packet. |
91 uint32_t last_encoded_timestamp_; | 89 uint32_t last_encoded_timestamp_; |
92 | 90 |
93 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderIsacT); | 91 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderIsacT); |
94 }; | 92 }; |
95 | 93 |
96 } // namespace webrtc | 94 } // namespace webrtc |
97 | 95 |
98 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_ | 96 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_AUDIO_ENCODER_ISAC_T_H_ |
OLD | NEW |