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

Unified Diff: webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc

Issue 1322973004: Fold AudioEncoderMutable into AudioEncoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: review fixes & stuff 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/audio_encoder_cng.cc
diff --git a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
index 279616e080e7e98b6522059bad5a05d271fb7371..3d9ad824be32b818d2a75d78a4e8f383c1cc3563 100644
--- a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
+++ b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc
@@ -21,16 +21,6 @@ const int kMaxFrameSizeMs = 60;
} // namespace
-AudioEncoderCng::Config::Config()
- : num_channels(1),
- payload_type(13),
- speech_encoder(NULL),
- vad_mode(Vad::kVadNormal),
- sid_frame_interval_ms(100),
- num_cng_coefficients(8),
- vad(NULL) {
-}
-
bool AudioEncoderCng::Config::IsOk() const {
if (num_channels != 1)
return false;
@@ -68,26 +58,25 @@ AudioEncoderCng::AudioEncoderCng(const Config& config)
<< "WebRtcCng_InitEnc failed";
}
-AudioEncoderCng::~AudioEncoderCng() {
+AudioEncoderCng::~AudioEncoderCng() = default;
+
+size_t AudioEncoderCng::MaxEncodedBytes() const {
+ const size_t max_encoded_bytes_active = speech_encoder_->MaxEncodedBytes();
+ const size_t max_encoded_bytes_passive =
+ rtc::CheckedDivExact(kMaxFrameSizeMs, 10) * SamplesPer10msFrame();
+ return std::max(max_encoded_bytes_active, max_encoded_bytes_passive);
}
int AudioEncoderCng::SampleRateHz() const {
return speech_encoder_->SampleRateHz();
}
-int AudioEncoderCng::RtpTimestampRateHz() const {
- return speech_encoder_->RtpTimestampRateHz();
-}
-
int AudioEncoderCng::NumChannels() const {
return 1;
}
-size_t AudioEncoderCng::MaxEncodedBytes() const {
- const size_t max_encoded_bytes_active = speech_encoder_->MaxEncodedBytes();
- const size_t max_encoded_bytes_passive =
- rtc::CheckedDivExact(kMaxFrameSizeMs, 10) * SamplesPer10msFrame();
- return std::max(max_encoded_bytes_active, max_encoded_bytes_passive);
+int AudioEncoderCng::RtpTimestampRateHz() const {
+ return speech_encoder_->RtpTimestampRateHz();
}
size_t AudioEncoderCng::Num10MsFramesInNextPacket() const {
@@ -102,16 +91,6 @@ int AudioEncoderCng::GetTargetBitrate() const {
return speech_encoder_->GetTargetBitrate();
}
-void AudioEncoderCng::SetTargetBitrate(int bits_per_second) {
- speech_encoder_->SetTargetBitrate(bits_per_second);
-}
-
-void AudioEncoderCng::SetProjectedPacketLossRate(double fraction) {
- DCHECK_GE(fraction, 0.0);
- DCHECK_LE(fraction, 1.0);
- speech_encoder_->SetProjectedPacketLossRate(fraction);
-}
-
AudioEncoder::EncodedInfo AudioEncoderCng::EncodeInternal(
uint32_t rtp_timestamp,
const int16_t* audio,
@@ -183,6 +162,42 @@ AudioEncoder::EncodedInfo AudioEncoderCng::EncodeInternal(
return info;
}
+void AudioEncoderCng::Reset() {
hlundin-webrtc 2015/09/07 20:00:01 There is state in AudioEncoderCng itself, too. Sho
kwiberg-webrtc 2015/09/08 10:47:45 Done. This required adding reset support to the Va
hlundin-webrtc 2015/09/08 11:21:26 Acknowledged.
+ speech_encoder_->Reset();
+}
+
+bool AudioEncoderCng::SetFec(bool enable) {
+ return speech_encoder_->SetFec(enable);
+}
+
+bool AudioEncoderCng::SetDtx(bool enable) {
+ return speech_encoder_->SetDtx(enable);
+}
+
+bool AudioEncoderCng::SetApplication(Application application) {
+ return speech_encoder_->SetApplication(application);
+}
+
+bool AudioEncoderCng::SetMaxPlaybackRate(int frequency_hz) {
+ return speech_encoder_->SetMaxPlaybackRate(frequency_hz);
+}
+
+void AudioEncoderCng::SetProjectedPacketLossRate(double fraction) {
+ speech_encoder_->SetProjectedPacketLossRate(fraction);
+}
+
+void AudioEncoderCng::SetTargetBitrate(int bits_per_second) {
+ speech_encoder_->SetTargetBitrate(bits_per_second);
+}
+
+void AudioEncoderCng::SetMaxBitrate(int max_bps) {
+ speech_encoder_->SetMaxBitrate(max_bps);
+}
+
+void AudioEncoderCng::SetMaxPayloadSize(int max_payload_size_bytes) {
+ speech_encoder_->SetMaxPayloadSize(max_payload_size_bytes);
+}
+
AudioEncoder::EncodedInfo AudioEncoderCng::EncodePassive(
size_t frames_to_encode,
size_t max_encoded_bytes,

Powered by Google App Engine
This is Rietveld 408576698