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

Unified Diff: webrtc/voice_engine/voe_codec_impl.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/voice_engine/voe_codec_impl.cc
diff --git a/webrtc/voice_engine/voe_codec_impl.cc b/webrtc/voice_engine/voe_codec_impl.cc
index 2022024536c164b13b9d77825940a7e579b279d1..a329463d7dcd1745c3254dcafdab7d0c8c1a1c87 100644
--- a/webrtc/voice_engine/voe_codec_impl.cc
+++ b/webrtc/voice_engine/voe_codec_impl.cc
@@ -388,4 +388,36 @@ int VoECodecImpl::GetOpusDtxStatus(int channel, bool* enabled) {
return channelPtr->GetOpusDtx(enabled);
}
+int VoECodecImpl::SetOpusCbr(int channel, bool enable_cbr) {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "SetOpusCbr(channel=%d, enable=%d)", channel, enable_cbr);
+ if (!_shared->statistics().Initialized()) {
+ _shared->SetLastError(VE_NOT_INITED, kTraceError);
+ return -1;
+ }
+ voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
+ voe::Channel* channelPtr = ch.channel();
+ if (channelPtr == NULL) {
+ _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
+ "SetOpusCbr() failed to locate channel");
+ return -1;
+ }
+ return channelPtr->SetOpusCbr(enable_cbr);
+}
+
+int VoECodecImpl::GetOpusCbrStatus(int channel, bool* enabled) {
+ if (!_shared->statistics().Initialized()) {
+ _shared->SetLastError(VE_NOT_INITED, kTraceError);
+ return -1;
+ }
+ voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
+ voe::Channel* channelPtr = ch.channel();
+ if (channelPtr == NULL) {
+ _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
+ "GetOpusCbrStatus() failed to locate channel");
+ return -1;
+ }
+ return channelPtr->GetOpusCbr(enabled);
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698