Index: webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h |
diff --git a/webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h b/webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h |
index 6a1136602e0b25929666febe78fbd30ed12d6db5..2ac1f95e577c2c86e52fe629c1f90c6c47ac10a8 100644 |
--- a/webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h |
+++ b/webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h |
@@ -20,53 +20,57 @@ |
namespace webrtc { |
+// Deleter for use with scoped_ptr. |
+struct CngInstDeleter { |
+ void operator()(CNG_enc_inst* ptr) const { WebRtcCng_FreeEnc(ptr); } |
+}; |
+ |
class Vad; |
class AudioEncoderCng final : public AudioEncoder { |
public: |
struct Config { |
- Config(); |
bool IsOk() const; |
- int num_channels; |
- int payload_type; |
+ int num_channels = 1; |
+ int payload_type = 13; |
// Caller keeps ownership of the AudioEncoder object. |
- AudioEncoder* speech_encoder; |
- Vad::Aggressiveness vad_mode; |
- int sid_frame_interval_ms; |
- int num_cng_coefficients; |
+ AudioEncoder* speech_encoder = nullptr; |
+ Vad::Aggressiveness vad_mode = Vad::kVadNormal; |
+ int sid_frame_interval_ms = 100; |
+ int num_cng_coefficients = 8; |
// The Vad pointer is mainly for testing. If a NULL pointer is passed, the |
// AudioEncoderCng creates (and destroys) a Vad object internally. If an |
// object is passed, the AudioEncoderCng assumes ownership of the Vad |
// object. |
- Vad* vad; |
+ Vad* vad = nullptr; |
}; |
explicit AudioEncoderCng(const Config& config); |
- |
~AudioEncoderCng() override; |
+ size_t MaxEncodedBytes() const override; |
int SampleRateHz() const override; |
int NumChannels() const override; |
- size_t MaxEncodedBytes() const override; |
int RtpTimestampRateHz() const override; |
size_t Num10MsFramesInNextPacket() const override; |
size_t Max10MsFramesInAPacket() const override; |
int GetTargetBitrate() const override; |
- void SetTargetBitrate(int bits_per_second) override; |
- void SetProjectedPacketLossRate(double fraction) override; |
EncodedInfo EncodeInternal(uint32_t rtp_timestamp, |
const int16_t* audio, |
size_t max_encoded_bytes, |
uint8_t* encoded) override; |
+ void Reset() override; |
+ bool SetFec(bool enable) override; |
+ bool SetDtx(bool enable) override; |
+ bool SetApplication(Application application) override; |
+ bool SetMaxPlaybackRate(int frequency_hz) override; |
+ void SetProjectedPacketLossRate(double fraction) override; |
+ void SetTargetBitrate(int target_bps) override; |
+ void SetMaxBitrate(int max_bps) override; |
+ void SetMaxPayloadSize(int max_payload_size_bytes) override; |
private: |
- // Deleter for use with scoped_ptr. E.g., use as |
- // rtc::scoped_ptr<CNG_enc_inst, CngInstDeleter> cng_inst_; |
- struct CngInstDeleter { |
- inline void operator()(CNG_enc_inst* ptr) const { WebRtcCng_FreeEnc(ptr); } |
- }; |
- |
EncodedInfo EncodePassive(size_t frames_to_encode, |
size_t max_encoded_bytes, |
uint8_t* encoded); |
@@ -78,6 +82,7 @@ class AudioEncoderCng final : public AudioEncoder { |
AudioEncoder* speech_encoder_; |
const int cng_payload_type_; |
const int num_cng_coefficients_; |
+ const int sid_frame_interval_ms_; |
std::vector<int16_t> speech_buffer_; |
std::vector<uint32_t> rtp_timestamps_; |
bool last_frame_active_; |