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

Side by Side Diff: webrtc/voice_engine/channel.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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 int success = -1; 1477 int success = -1;
1478 audio_coding_->QueryEncoder([&](AudioEncoder const* encoder) { 1478 audio_coding_->QueryEncoder([&](AudioEncoder const* encoder) {
1479 if (encoder) { 1479 if (encoder) {
1480 *enabled = encoder->GetDtx(); 1480 *enabled = encoder->GetDtx();
1481 success = 0; 1481 success = 0;
1482 } 1482 }
1483 }); 1483 });
1484 return success; 1484 return success;
1485 } 1485 }
1486 1486
1487 int Channel::SetOpusCbr(bool enable_cbr) {
1488 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1489 "Channel::SetOpusCbr(%d)", enable_cbr);
1490
1491 int ret = enable_cbr ? audio_coding_->EnableOpusCbr()
1492 : audio_coding_->DisableOpusCbr();
1493
1494 if (ret != 0) {
1495 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR,
1496 kTraceError, "SetOpusCbr() failed");
1497 return -1;
1498 }
1499 return 0;
1500 }
1501
1502 int Channel::GetOpusCbr(bool* enabled) {
1503 int success = -1;
1504 audio_coding_->QueryEncoder([&](AudioEncoder const* encoder) {
1505 if (encoder) {
1506 *enabled = encoder->GetCbr();
1507 success = 0;
1508 }
1509 });
1510 return success;
1511 }
1512
1487 bool Channel::EnableAudioNetworkAdaptor(const std::string& config_string) { 1513 bool Channel::EnableAudioNetworkAdaptor(const std::string& config_string) {
1488 bool success = false; 1514 bool success = false;
1489 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { 1515 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
1490 if (*encoder) { 1516 if (*encoder) {
1491 success = (*encoder)->EnableAudioNetworkAdaptor( 1517 success = (*encoder)->EnableAudioNetworkAdaptor(
1492 config_string, event_log_proxy_.get(), Clock::GetRealTimeClock()); 1518 config_string, event_log_proxy_.get(), Clock::GetRealTimeClock());
1493 } 1519 }
1494 }); 1520 });
1495 return success; 1521 return success;
1496 } 1522 }
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 int64_t min_rtt = 0; 3018 int64_t min_rtt = 0;
2993 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3019 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
2994 0) { 3020 0) {
2995 return 0; 3021 return 0;
2996 } 3022 }
2997 return rtt; 3023 return rtt;
2998 } 3024 }
2999 3025
3000 } // namespace voe 3026 } // namespace voe
3001 } // namespace webrtc 3027 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698