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

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

Issue 2516993002: Pass SdpAudioFormat through Channel, without converting to CodecInst (Closed)
Patch Set: emulate bug 6986 Created 3 years, 11 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
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 ACMVADMode& mode, 1365 ACMVADMode& mode,
1366 bool& disabledDTX) { 1366 bool& disabledDTX) {
1367 const auto* params = codec_manager_.GetStackParams(); 1367 const auto* params = codec_manager_.GetStackParams();
1368 enabledVAD = params->use_cng; 1368 enabledVAD = params->use_cng;
1369 mode = params->vad_mode; 1369 mode = params->vad_mode;
1370 disabledDTX = !params->use_cng; 1370 disabledDTX = !params->use_cng;
1371 return 0; 1371 return 0;
1372 } 1372 }
1373 1373
1374 int32_t Channel::SetRecPayloadType(const CodecInst& codec) { 1374 int32_t Channel::SetRecPayloadType(const CodecInst& codec) {
1375 return SetRecPayloadType(codec.pltype, CodecInstToSdp(codec));
1376 }
1377
1378 int32_t Channel::SetRecPayloadType(int payload_type,
1379 const SdpAudioFormat& format) {
1375 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1380 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1376 "Channel::SetRecPayloadType()"); 1381 "Channel::SetRecPayloadType()");
1377 1382
1378 if (channel_state_.Get().playing) { 1383 if (channel_state_.Get().playing) {
1379 _engineStatisticsPtr->SetLastError( 1384 _engineStatisticsPtr->SetLastError(
1380 VE_ALREADY_PLAYING, kTraceError, 1385 VE_ALREADY_PLAYING, kTraceError,
1381 "SetRecPayloadType() unable to set PT while playing"); 1386 "SetRecPayloadType() unable to set PT while playing");
1382 return -1; 1387 return -1;
1383 } 1388 }
1384 1389
1385 if (codec.pltype == -1) { 1390 const CodecInst codec = [&] {
1391 CodecInst c = SdpToCodecInst(payload_type, format);
1392
1393 // Bug 6986: Emulate an old bug that caused us to always choose to decode
the sun 2017/01/19 13:05:14 nit: Add TODO
kwiberg-webrtc 2017/01/19 13:28:46 Done. I neglected to do this because I felt that m
1394 // Opus in stereo. To be able to remove this, we first need to fix the
1395 // other half of bug 6986, which is about losing the Opus "stereo"
1396 // parameter.
1397 if (STR_CASE_CMP(codec.plname, "opus") == 0) {
1398 c.channels = 2;
1399 }
1400
1401 return c;
1402 }();
1403
1404 if (payload_type == -1) {
1386 // De-register the selected codec (RTP/RTCP module and ACM) 1405 // De-register the selected codec (RTP/RTCP module and ACM)
1387 1406
1388 int8_t pltype(-1); 1407 int8_t pltype(-1);
1389 CodecInst rxCodec = codec; 1408 CodecInst rxCodec = codec;
1390 1409
1391 // Get payload type for the given codec 1410 // Get payload type for the given codec
1392 rtp_payload_registry_->ReceivePayloadType(rxCodec, &pltype); 1411 rtp_payload_registry_->ReceivePayloadType(rxCodec, &pltype);
1393 rxCodec.pltype = pltype; 1412 rxCodec.pltype = pltype;
1394 1413
1395 if (rtp_receiver_->DeRegisterReceivePayload(pltype) != 0) { 1414 if (rtp_receiver_->DeRegisterReceivePayload(pltype) != 0) {
(...skipping 17 matching lines...) Expand all
1413 // TODO(kwiberg): Retrying is probably not necessary, since 1432 // TODO(kwiberg): Retrying is probably not necessary, since
1414 // AcmReceiver::AddCodec also retries. 1433 // AcmReceiver::AddCodec also retries.
1415 rtp_receiver_->DeRegisterReceivePayload(codec.pltype); 1434 rtp_receiver_->DeRegisterReceivePayload(codec.pltype);
1416 if (rtp_receiver_->RegisterReceivePayload(codec) != 0) { 1435 if (rtp_receiver_->RegisterReceivePayload(codec) != 0) {
1417 _engineStatisticsPtr->SetLastError( 1436 _engineStatisticsPtr->SetLastError(
1418 VE_RTP_RTCP_MODULE_ERROR, kTraceError, 1437 VE_RTP_RTCP_MODULE_ERROR, kTraceError,
1419 "SetRecPayloadType() RTP/RTCP-module registration failed"); 1438 "SetRecPayloadType() RTP/RTCP-module registration failed");
1420 return -1; 1439 return -1;
1421 } 1440 }
1422 } 1441 }
1423 if (!audio_coding_->RegisterReceiveCodec(codec.pltype, 1442 if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) {
1424 CodecInstToSdp(codec))) { 1443 audio_coding_->UnregisterReceiveCodec(payload_type);
1425 audio_coding_->UnregisterReceiveCodec(codec.pltype); 1444 if (!audio_coding_->RegisterReceiveCodec(payload_type, format)) {
1426 if (!audio_coding_->RegisterReceiveCodec(codec.pltype,
1427 CodecInstToSdp(codec))) {
1428 _engineStatisticsPtr->SetLastError( 1445 _engineStatisticsPtr->SetLastError(
1429 VE_AUDIO_CODING_MODULE_ERROR, kTraceError, 1446 VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
1430 "SetRecPayloadType() ACM registration failed - 1"); 1447 "SetRecPayloadType() ACM registration failed - 1");
1431 return -1; 1448 return -1;
1432 } 1449 }
1433 } 1450 }
1434 return 0; 1451 return 0;
1435 } 1452 }
1436 1453
1437 int32_t Channel::GetRecPayloadType(CodecInst& codec) { 1454 int32_t Channel::GetRecPayloadType(CodecInst& codec) {
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
3277 int64_t min_rtt = 0; 3294 int64_t min_rtt = 0;
3278 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3295 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3279 0) { 3296 0) {
3280 return 0; 3297 return 0;
3281 } 3298 }
3282 return rtt; 3299 return rtt;
3283 } 3300 }
3284 3301
3285 } // namespace voe 3302 } // namespace voe
3286 } // namespace webrtc 3303 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | webrtc/voice_engine/channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698