OLD | NEW |
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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 ACMVADMode& mode, | 1338 ACMVADMode& mode, |
1339 bool& disabledDTX) { | 1339 bool& disabledDTX) { |
1340 const auto* params = codec_manager_.GetStackParams(); | 1340 const auto* params = codec_manager_.GetStackParams(); |
1341 enabledVAD = params->use_cng; | 1341 enabledVAD = params->use_cng; |
1342 mode = params->vad_mode; | 1342 mode = params->vad_mode; |
1343 disabledDTX = !params->use_cng; | 1343 disabledDTX = !params->use_cng; |
1344 return 0; | 1344 return 0; |
1345 } | 1345 } |
1346 | 1346 |
1347 int32_t Channel::SetRecPayloadType(const CodecInst& codec) { | 1347 int32_t Channel::SetRecPayloadType(const CodecInst& codec) { |
| 1348 return SetRecPayloadType(codec.pltype, CodecInstToSdp(codec)); |
| 1349 } |
| 1350 |
| 1351 int32_t Channel::SetRecPayloadType(int payload_type, |
| 1352 const SdpAudioFormat& format) { |
1348 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1353 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
1349 "Channel::SetRecPayloadType()"); | 1354 "Channel::SetRecPayloadType()"); |
1350 | 1355 |
1351 if (channel_state_.Get().playing) { | 1356 if (channel_state_.Get().playing) { |
1352 _engineStatisticsPtr->SetLastError( | 1357 _engineStatisticsPtr->SetLastError( |
1353 VE_ALREADY_PLAYING, kTraceError, | 1358 VE_ALREADY_PLAYING, kTraceError, |
1354 "SetRecPayloadType() unable to set PT while playing"); | 1359 "SetRecPayloadType() unable to set PT while playing"); |
1355 return -1; | 1360 return -1; |
1356 } | 1361 } |
1357 | 1362 |
1358 if (codec.pltype == -1) { | 1363 const CodecInst codec = SdpToCodecInst(payload_type, format); |
| 1364 |
| 1365 if (payload_type == -1) { |
1359 // De-register the selected codec (RTP/RTCP module and ACM) | 1366 // De-register the selected codec (RTP/RTCP module and ACM) |
1360 | 1367 |
1361 int8_t pltype(-1); | 1368 int8_t pltype(-1); |
1362 CodecInst rxCodec = codec; | 1369 CodecInst rxCodec = codec; |
1363 | 1370 |
1364 // Get payload type for the given codec | 1371 // Get payload type for the given codec |
1365 rtp_payload_registry_->ReceivePayloadType(rxCodec.plname, rxCodec.plfreq, | 1372 rtp_payload_registry_->ReceivePayloadType( |
1366 rxCodec.channels, &pltype); | 1373 format.name.c_str(), rxCodec.plfreq, rxCodec.channels, &pltype); |
1367 rxCodec.pltype = pltype; | 1374 rxCodec.pltype = pltype; |
1368 | 1375 |
1369 if (rtp_receiver_->DeRegisterReceivePayload(pltype) != 0) { | 1376 if (rtp_receiver_->DeRegisterReceivePayload(pltype) != 0) { |
1370 _engineStatisticsPtr->SetLastError( | 1377 _engineStatisticsPtr->SetLastError( |
1371 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 1378 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
1372 "SetRecPayloadType() RTP/RTCP-module deregistration " | 1379 "SetRecPayloadType() RTP/RTCP-module deregistration " |
1373 "failed"); | 1380 "failed"); |
1374 return -1; | 1381 return -1; |
1375 } | 1382 } |
1376 if (audio_coding_->UnregisterReceiveCodec(rxCodec.pltype) != 0) { | 1383 if (audio_coding_->UnregisterReceiveCodec(rxCodec.pltype) != 0) { |
(...skipping 14 matching lines...) Expand all Loading... |
1391 rtp_receiver_->DeRegisterReceivePayload(codec.pltype); | 1398 rtp_receiver_->DeRegisterReceivePayload(codec.pltype); |
1392 if (rtp_receiver_->RegisterReceivePayload( | 1399 if (rtp_receiver_->RegisterReceivePayload( |
1393 codec.plname, codec.pltype, codec.plfreq, codec.channels, | 1400 codec.plname, codec.pltype, codec.plfreq, codec.channels, |
1394 (codec.rate < 0) ? 0 : codec.rate) != 0) { | 1401 (codec.rate < 0) ? 0 : codec.rate) != 0) { |
1395 _engineStatisticsPtr->SetLastError( | 1402 _engineStatisticsPtr->SetLastError( |
1396 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 1403 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
1397 "SetRecPayloadType() RTP/RTCP-module registration failed"); | 1404 "SetRecPayloadType() RTP/RTCP-module registration failed"); |
1398 return -1; | 1405 return -1; |
1399 } | 1406 } |
1400 } | 1407 } |
1401 if (!audio_coding_->RegisterReceiveCodec(codec.pltype, | 1408 if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) { |
1402 CodecInstToSdp(codec))) { | 1409 audio_coding_->UnregisterReceiveCodec(payload_type); |
1403 audio_coding_->UnregisterReceiveCodec(codec.pltype); | 1410 if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) { |
1404 if (!audio_coding_->RegisterReceiveCodec(codec.pltype, | |
1405 CodecInstToSdp(codec))) { | |
1406 _engineStatisticsPtr->SetLastError( | 1411 _engineStatisticsPtr->SetLastError( |
1407 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, | 1412 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, |
1408 "SetRecPayloadType() ACM registration failed - 1"); | 1413 "SetRecPayloadType() ACM registration failed - 1"); |
1409 return -1; | 1414 return -1; |
1410 } | 1415 } |
1411 } | 1416 } |
1412 return 0; | 1417 return 0; |
1413 } | 1418 } |
1414 | 1419 |
1415 int32_t Channel::GetRecPayloadType(CodecInst& codec) { | 1420 int32_t Channel::GetRecPayloadType(CodecInst& codec) { |
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3238 int64_t min_rtt = 0; | 3243 int64_t min_rtt = 0; |
3239 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3244 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3240 0) { | 3245 0) { |
3241 return 0; | 3246 return 0; |
3242 } | 3247 } |
3243 return rtt; | 3248 return rtt; |
3244 } | 3249 } |
3245 | 3250 |
3246 } // namespace voe | 3251 } // namespace voe |
3247 } // namespace webrtc | 3252 } // namespace webrtc |
OLD | NEW |