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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 }; | 43 }; |
44 | 44 |
45 explicit AudioEncoderCng(const Config& config); | 45 explicit AudioEncoderCng(const Config& config); |
46 | 46 |
47 ~AudioEncoderCng() override; | 47 ~AudioEncoderCng() override; |
48 | 48 |
49 int SampleRateHz() const override; | 49 int SampleRateHz() const override; |
50 int NumChannels() const override; | 50 int NumChannels() const override; |
51 size_t MaxEncodedBytes() const override; | 51 size_t MaxEncodedBytes() const override; |
52 int RtpTimestampRateHz() const override; | 52 int RtpTimestampRateHz() const override; |
53 int Num10MsFramesInNextPacket() const override; | 53 size_t Num10MsFramesInNextPacket() const override; |
54 int Max10MsFramesInAPacket() const override; | 54 size_t Max10MsFramesInAPacket() const override; |
55 int GetTargetBitrate() const override; | 55 int GetTargetBitrate() const override; |
56 void SetTargetBitrate(int bits_per_second) override; | 56 void SetTargetBitrate(int bits_per_second) override; |
57 void SetProjectedPacketLossRate(double fraction) override; | 57 void SetProjectedPacketLossRate(double fraction) override; |
58 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, | 58 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, |
59 const int16_t* audio, | 59 const int16_t* audio, |
60 size_t max_encoded_bytes, | 60 size_t max_encoded_bytes, |
61 uint8_t* encoded) override; | 61 uint8_t* encoded) override; |
62 | 62 |
63 private: | 63 private: |
64 // Deleter for use with scoped_ptr. E.g., use as | 64 // Deleter for use with scoped_ptr. E.g., use as |
65 // rtc::scoped_ptr<CNG_enc_inst, CngInstDeleter> cng_inst_; | 65 // rtc::scoped_ptr<CNG_enc_inst, CngInstDeleter> cng_inst_; |
66 struct CngInstDeleter { | 66 struct CngInstDeleter { |
67 inline void operator()(CNG_enc_inst* ptr) const { WebRtcCng_FreeEnc(ptr); } | 67 inline void operator()(CNG_enc_inst* ptr) const { WebRtcCng_FreeEnc(ptr); } |
68 }; | 68 }; |
69 | 69 |
70 EncodedInfo EncodePassive(int frames_to_encode, | 70 EncodedInfo EncodePassive(size_t frames_to_encode, |
71 size_t max_encoded_bytes, | 71 size_t max_encoded_bytes, |
72 uint8_t* encoded); | 72 uint8_t* encoded); |
73 EncodedInfo EncodeActive(int frames_to_encode, | 73 EncodedInfo EncodeActive(size_t frames_to_encode, |
74 size_t max_encoded_bytes, | 74 size_t max_encoded_bytes, |
75 uint8_t* encoded); | 75 uint8_t* encoded); |
76 size_t SamplesPer10msFrame() const; | 76 size_t SamplesPer10msFrame() const; |
77 | 77 |
78 AudioEncoder* speech_encoder_; | 78 AudioEncoder* speech_encoder_; |
79 const int cng_payload_type_; | 79 const int cng_payload_type_; |
80 const int num_cng_coefficients_; | 80 const int num_cng_coefficients_; |
81 std::vector<int16_t> speech_buffer_; | 81 std::vector<int16_t> speech_buffer_; |
82 std::vector<uint32_t> rtp_timestamps_; | 82 std::vector<uint32_t> rtp_timestamps_; |
83 bool last_frame_active_; | 83 bool last_frame_active_; |
84 rtc::scoped_ptr<Vad> vad_; | 84 rtc::scoped_ptr<Vad> vad_; |
85 rtc::scoped_ptr<CNG_enc_inst, CngInstDeleter> cng_inst_; | 85 rtc::scoped_ptr<CNG_enc_inst, CngInstDeleter> cng_inst_; |
86 }; | 86 }; |
87 | 87 |
88 } // namespace webrtc | 88 } // namespace webrtc |
89 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_INCLUDE_AUDIO_ENCODER_CNG_H_ | 89 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_INCLUDE_AUDIO_ENCODER_CNG_H_ |
OLD | NEW |