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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 int frame_size_ms = 30; // Valid values are 20, 30, 40, and 60 ms. | 29 int frame_size_ms = 30; // Valid values are 20, 30, 40, and 60 ms. |
30 // Note that frame size 40 ms produces encodings with two 20 ms frames in | 30 // Note that frame size 40 ms produces encodings with two 20 ms frames in |
31 // them, and frame size 60 ms consists of two 30 ms frames. | 31 // them, and frame size 60 ms consists of two 30 ms frames. |
32 }; | 32 }; |
33 | 33 |
34 explicit AudioEncoderIlbc(const Config& config); | 34 explicit AudioEncoderIlbc(const Config& config); |
35 explicit AudioEncoderIlbc(const CodecInst& codec_inst); | 35 explicit AudioEncoderIlbc(const CodecInst& codec_inst); |
36 AudioEncoderIlbc(int payload_type, const SdpAudioFormat& format); | 36 AudioEncoderIlbc(int payload_type, const SdpAudioFormat& format); |
37 ~AudioEncoderIlbc() override; | 37 ~AudioEncoderIlbc() override; |
38 | 38 |
39 static constexpr const char* GetPayloadName() { return "ilbc"; } | 39 static constexpr const char* GetPayloadName() { return "ILBC"; } |
40 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder( | 40 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder( |
41 const SdpAudioFormat& format); | 41 const SdpAudioFormat& format); |
42 | 42 |
43 int SampleRateHz() const override; | 43 int SampleRateHz() const override; |
44 size_t NumChannels() const override; | 44 size_t NumChannels() const override; |
45 size_t Num10MsFramesInNextPacket() const override; | 45 size_t Num10MsFramesInNextPacket() const override; |
46 size_t Max10MsFramesInAPacket() const override; | 46 size_t Max10MsFramesInAPacket() const override; |
47 int GetTargetBitrate() const override; | 47 int GetTargetBitrate() const override; |
48 EncodedInfo EncodeImpl(uint32_t rtp_timestamp, | 48 EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
49 rtc::ArrayView<const int16_t> audio, | 49 rtc::ArrayView<const int16_t> audio, |
50 rtc::Buffer* encoded) override; | 50 rtc::Buffer* encoded) override; |
51 void Reset() override; | 51 void Reset() override; |
52 | 52 |
53 private: | 53 private: |
54 size_t RequiredOutputSizeBytes() const; | 54 size_t RequiredOutputSizeBytes() const; |
55 | 55 |
56 static const size_t kMaxSamplesPerPacket = 480; | 56 static const size_t kMaxSamplesPerPacket = 480; |
57 const Config config_; | 57 const Config config_; |
58 const size_t num_10ms_frames_per_packet_; | 58 const size_t num_10ms_frames_per_packet_; |
59 size_t num_10ms_frames_buffered_; | 59 size_t num_10ms_frames_buffered_; |
60 uint32_t first_timestamp_in_buffer_; | 60 uint32_t first_timestamp_in_buffer_; |
61 int16_t input_buffer_[kMaxSamplesPerPacket]; | 61 int16_t input_buffer_[kMaxSamplesPerPacket]; |
62 IlbcEncoderInstance* encoder_; | 62 IlbcEncoderInstance* encoder_; |
63 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderIlbc); | 63 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderIlbc); |
64 }; | 64 }; |
65 | 65 |
66 } // namespace webrtc | 66 } // namespace webrtc |
67 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_ | 67 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_ |
OLD | NEW |