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

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

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

Powered by Google App Engine
This is Rietveld 408576698