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

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

Issue 2516993002: Pass SdpAudioFormat through Channel, without converting to CodecInst (Closed)
Patch Set: opus default stereo Created 4 years 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 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 ACMVADMode& mode, 1383 ACMVADMode& mode,
1384 bool& disabledDTX) { 1384 bool& disabledDTX) {
1385 const auto* params = codec_manager_.GetStackParams(); 1385 const auto* params = codec_manager_.GetStackParams();
1386 enabledVAD = params->use_cng; 1386 enabledVAD = params->use_cng;
1387 mode = params->vad_mode; 1387 mode = params->vad_mode;
1388 disabledDTX = !params->use_cng; 1388 disabledDTX = !params->use_cng;
1389 return 0; 1389 return 0;
1390 } 1390 }
1391 1391
1392 int32_t Channel::SetRecPayloadType(const CodecInst& codec) { 1392 int32_t Channel::SetRecPayloadType(const CodecInst& codec) {
1393 return SetRecPayloadType(codec.pltype, CodecInstToSdp(codec));
1394 }
1395
1396 int32_t Channel::SetRecPayloadType(int payload_type,
1397 const SdpAudioFormat& format) {
1393 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1398 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1394 "Channel::SetRecPayloadType()"); 1399 "Channel::SetRecPayloadType()");
1395 1400
1396 if (channel_state_.Get().playing) { 1401 if (channel_state_.Get().playing) {
1397 _engineStatisticsPtr->SetLastError( 1402 _engineStatisticsPtr->SetLastError(
1398 VE_ALREADY_PLAYING, kTraceError, 1403 VE_ALREADY_PLAYING, kTraceError,
1399 "SetRecPayloadType() unable to set PT while playing"); 1404 "SetRecPayloadType() unable to set PT while playing");
1400 return -1; 1405 return -1;
1401 } 1406 }
1402 1407
1403 if (codec.pltype == -1) { 1408 const CodecInst codec = SdpToCodecInst(payload_type, format);
1409
1410 if (payload_type == -1) {
1404 // De-register the selected codec (RTP/RTCP module and ACM) 1411 // De-register the selected codec (RTP/RTCP module and ACM)
1405 1412
1406 int8_t pltype(-1); 1413 int8_t pltype(-1);
1407 CodecInst rxCodec = codec; 1414 CodecInst rxCodec = codec;
1408 1415
1409 // Get payload type for the given codec 1416 // Get payload type for the given codec
1410 rtp_payload_registry_->ReceivePayloadType(rxCodec, &pltype); 1417 rtp_payload_registry_->ReceivePayloadType(rxCodec, &pltype);
1411 rxCodec.pltype = pltype; 1418 rxCodec.pltype = pltype;
1412 1419
1413 if (rtp_receiver_->DeRegisterReceivePayload(pltype) != 0) { 1420 if (rtp_receiver_->DeRegisterReceivePayload(pltype) != 0) {
(...skipping 17 matching lines...) Expand all
1431 // TODO(kwiberg): Retrying is probably not necessary, since 1438 // TODO(kwiberg): Retrying is probably not necessary, since
1432 // AcmReceiver::AddCodec also retries. 1439 // AcmReceiver::AddCodec also retries.
1433 rtp_receiver_->DeRegisterReceivePayload(codec.pltype); 1440 rtp_receiver_->DeRegisterReceivePayload(codec.pltype);
1434 if (rtp_receiver_->RegisterReceivePayload(codec) != 0) { 1441 if (rtp_receiver_->RegisterReceivePayload(codec) != 0) {
1435 _engineStatisticsPtr->SetLastError( 1442 _engineStatisticsPtr->SetLastError(
1436 VE_RTP_RTCP_MODULE_ERROR, kTraceError, 1443 VE_RTP_RTCP_MODULE_ERROR, kTraceError,
1437 "SetRecPayloadType() RTP/RTCP-module registration failed"); 1444 "SetRecPayloadType() RTP/RTCP-module registration failed");
1438 return -1; 1445 return -1;
1439 } 1446 }
1440 } 1447 }
1441 if (!audio_coding_->RegisterReceiveCodec(codec.pltype, 1448 if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) {
1442 CodecInstToSdp(codec))) { 1449 audio_coding_->UnregisterReceiveCodec(payload_type);
1443 audio_coding_->UnregisterReceiveCodec(codec.pltype); 1450 if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) {
1444 if (!audio_coding_->RegisterReceiveCodec(codec.pltype,
1445 CodecInstToSdp(codec))) {
1446 _engineStatisticsPtr->SetLastError( 1451 _engineStatisticsPtr->SetLastError(
1447 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, 1452 VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
1448 "SetRecPayloadType() ACM registration failed - 1"); 1453 "SetRecPayloadType() ACM registration failed - 1");
1449 return -1; 1454 return -1;
1450 } 1455 }
1451 } 1456 }
1452 return 0; 1457 return 0;
1453 } 1458 }
1454 1459
1455 int32_t Channel::GetRecPayloadType(CodecInst& codec) { 1460 int32_t Channel::GetRecPayloadType(CodecInst& codec) {
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
3288 int64_t min_rtt = 0; 3293 int64_t min_rtt = 0;
3289 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3294 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3290 0) { 3295 0) {
3291 return 0; 3296 return 0;
3292 } 3297 }
3293 return rtt; 3298 return rtt;
3294 } 3299 }
3295 3300
3296 } // namespace voe 3301 } // namespace voe
3297 } // namespace webrtc 3302 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698