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

Unified Diff: webrtc/modules/audio_coding/acm2/audio_coding_module.cc

Issue 2772773002: Adding cbr support for Opus (Closed)
Patch Set: Created 3 years, 9 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/acm2/audio_coding_module.cc
diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
index daeea3577e23a854d26f9b702c6d84f1c5ec989d..3b07ce3284c32cfa6df8c478fb807470d4a3010e 100644
--- a/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
+++ b/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
@@ -190,6 +190,10 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
int DisableOpusDtx() override;
+ int EnableOpusCbr() override;
minyue-webrtc 2017/03/29 20:45:26 nit: make order between Cbr and Dtx consistent
+
+ int DisableOpusCbr() override;
+
int UnregisterReceiveCodec(uint8_t payload_type) override;
int EnableNack(size_t max_nack_list_size) override;
@@ -400,6 +404,7 @@ class RawAudioEncoderWrapper final : public AudioEncoder {
}
void Reset() override { return enc_->Reset(); }
bool SetFec(bool enable) override { return enc_->SetFec(enable); }
+ bool SetCbr(bool enable) override { return enc_->SetCbr(enable); }
bool SetDtx(bool enable) override { return enc_->SetDtx(enable); }
bool SetApplication(Application application) override {
return enc_->SetApplication(application);
@@ -1234,6 +1239,22 @@ int AudioCodingModuleImpl::DisableOpusDtx() {
return encoder_stack_->SetDtx(false) ? 0 : -1;
}
+int AudioCodingModuleImpl::EnableOpusCbr() {
+ rtc::CritScope lock(&acm_crit_sect_);
+ if (!HaveValidEncoder("EnableOpusCbr")) {
+ return -1;
+ }
+ return encoder_stack_->SetCbr(true) ? 0 : -1;
+}
+
+int AudioCodingModuleImpl::DisableOpusCbr() {
+ rtc::CritScope lock(&acm_crit_sect_);
+ if (!HaveValidEncoder("DisableOpusCbr")) {
+ return -1;
+ }
+ return encoder_stack_->SetCbr(false) ? 0 : -1;
+}
+
int32_t AudioCodingModuleImpl::PlayoutTimestamp(uint32_t* timestamp) {
rtc::Optional<uint32_t> ts = PlayoutTimestamp();
if (!ts)

Powered by Google App Engine
This is Rietveld 408576698