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

Unified Diff: webrtc/modules/audio_coding/codecs/cng/include/audio_encoder_cng.h

Issue 1322973004: Fold AudioEncoderMutable into AudioEncoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: review fixes Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698