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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 2429503002: Simplifying audio network adaptor by moving receiver frame length range to ctor. (Closed)
Patch Set: Created 4 years, 2 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 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 int success = -1; 1501 int success = -1;
1502 audio_coding_->QueryEncoder([&](AudioEncoder const* encoder) { 1502 audio_coding_->QueryEncoder([&](AudioEncoder const* encoder) {
1503 if (encoder) { 1503 if (encoder) {
1504 *enabled = encoder->GetDtx(); 1504 *enabled = encoder->GetDtx();
1505 success = 0; 1505 success = 0;
1506 } 1506 }
1507 }); 1507 });
1508 return success; 1508 return success;
1509 } 1509 }
1510 1510
1511 bool Channel::EnableAudioNetworkAdaptor(const std::string& config_string) { 1511 bool Channel::EnableAudioNetworkAdaptor(const std::string& config_string,
1512 int min_receiver_frame_length_ms,
1513 int max_receiver_frame_length_ms) {
1512 bool success = false; 1514 bool success = false;
1513 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { 1515 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
1514 if (*encoder) { 1516 if (*encoder) {
1515 success = (*encoder)->EnableAudioNetworkAdaptor( 1517 success = (*encoder)->EnableAudioNetworkAdaptor(
1516 config_string, Clock::GetRealTimeClock()); 1518 config_string, min_receiver_frame_length_ms,
1519 max_receiver_frame_length_ms, Clock::GetRealTimeClock());
1517 } 1520 }
1518 }); 1521 });
1519 return success; 1522 return success;
1520 } 1523 }
1521 1524
1522 void Channel::DisableAudioNetworkAdaptor() { 1525 void Channel::DisableAudioNetworkAdaptor() {
1523 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { 1526 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
1524 if (*encoder) 1527 if (*encoder)
1525 (*encoder)->DisableAudioNetworkAdaptor(); 1528 (*encoder)->DisableAudioNetworkAdaptor();
1526 }); 1529 });
1527 } 1530 }
1528 1531
1529 void Channel::SetReceiverFrameLengthRange(int min_frame_length_ms,
1530 int max_frame_length_ms) {
1531 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
1532 if (*encoder) {
1533 (*encoder)->SetReceiverFrameLengthRange(min_frame_length_ms,
1534 max_frame_length_ms);
1535 }
1536 });
1537 }
1538
1539 int32_t Channel::RegisterExternalTransport(Transport* transport) { 1532 int32_t Channel::RegisterExternalTransport(Transport* transport) {
1540 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1533 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1541 "Channel::RegisterExternalTransport()"); 1534 "Channel::RegisterExternalTransport()");
1542 1535
1543 rtc::CritScope cs(&_callbackCritSect); 1536 rtc::CritScope cs(&_callbackCritSect);
1544 if (_externalTransport) { 1537 if (_externalTransport) {
1545 _engineStatisticsPtr->SetLastError( 1538 _engineStatisticsPtr->SetLastError(
1546 VE_INVALID_OPERATION, kTraceError, 1539 VE_INVALID_OPERATION, kTraceError,
1547 "RegisterExternalTransport() external transport already enabled"); 1540 "RegisterExternalTransport() external transport already enabled");
1548 return -1; 1541 return -1;
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 int64_t min_rtt = 0; 3236 int64_t min_rtt = 0;
3244 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3237 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3245 0) { 3238 0) {
3246 return 0; 3239 return 0;
3247 } 3240 }
3248 return rtt; 3241 return rtt;
3249 } 3242 }
3250 3243
3251 } // namespace voe 3244 } // namespace voe
3252 } // namespace webrtc 3245 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698