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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); 381 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
382 voe::Channel* channelPtr = ch.channel(); 382 voe::Channel* channelPtr = ch.channel();
383 if (channelPtr == NULL) { 383 if (channelPtr == NULL) {
384 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, 384 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
385 "GetOpusDtx failed to locate channel"); 385 "GetOpusDtx failed to locate channel");
386 return -1; 386 return -1;
387 } 387 }
388 return channelPtr->GetOpusDtx(enabled); 388 return channelPtr->GetOpusDtx(enabled);
389 } 389 }
390 390
391 int VoECodecImpl::SetOpusCbr(int channel, bool enable_cbr) {
392 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
393 "SetOpusCbr(channel=%d, enable=%d)", channel, enable_cbr);
394 if (!_shared->statistics().Initialized()) {
395 _shared->SetLastError(VE_NOT_INITED, kTraceError);
396 return -1;
397 }
398 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
399 voe::Channel* channelPtr = ch.channel();
400 if (channelPtr == NULL) {
401 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
402 "SetOpusCbr() failed to locate channel");
403 return -1;
404 }
405 return channelPtr->SetOpusCbr(enable_cbr);
406 }
407
408 int VoECodecImpl::GetOpusCbrStatus(int channel, bool* enabled) {
409 if (!_shared->statistics().Initialized()) {
410 _shared->SetLastError(VE_NOT_INITED, kTraceError);
411 return -1;
412 }
413 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
414 voe::Channel* channelPtr = ch.channel();
415 if (channelPtr == NULL) {
416 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
417 "GetOpusCbrStatus() failed to locate channel");
418 return -1;
419 }
420 return channelPtr->GetOpusCbr(enabled);
421 }
422
391 } // namespace webrtc 423 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698