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

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

Issue 1909333002: Switch voice transport to use Call and Stream instead of VoENetwork. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed coments on ps#6 Created 4 years, 7 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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 int ret = enable_dtx ? audio_coding_->EnableOpusDtx() 1442 int ret = enable_dtx ? audio_coding_->EnableOpusDtx()
1443 : audio_coding_->DisableOpusDtx(); 1443 : audio_coding_->DisableOpusDtx();
1444 if (ret != 0) { 1444 if (ret != 0) {
1445 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR, 1445 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR,
1446 kTraceError, "SetOpusDtx() failed"); 1446 kTraceError, "SetOpusDtx() failed");
1447 return -1; 1447 return -1;
1448 } 1448 }
1449 return 0; 1449 return 0;
1450 } 1450 }
1451 1451
1452 int32_t Channel::RegisterExternalTransport(Transport& transport) { 1452 int32_t Channel::RegisterExternalTransport(Transport* transport) {
1453 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1453 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1454 "Channel::RegisterExternalTransport()"); 1454 "Channel::RegisterExternalTransport()");
1455 1455
1456 rtc::CritScope cs(&_callbackCritSect); 1456 rtc::CritScope cs(&_callbackCritSect);
1457
1458 if (_externalTransport) { 1457 if (_externalTransport) {
1459 _engineStatisticsPtr->SetLastError( 1458 _engineStatisticsPtr->SetLastError(
1460 VE_INVALID_OPERATION, kTraceError, 1459 VE_INVALID_OPERATION, kTraceError,
1461 "RegisterExternalTransport() external transport already enabled"); 1460 "RegisterExternalTransport() external transport already enabled");
1462 return -1; 1461 return -1;
1463 } 1462 }
1464 _externalTransport = true; 1463 _externalTransport = true;
1465 _transportPtr = &transport; 1464 _transportPtr = transport;
1466 return 0; 1465 return 0;
1467 } 1466 }
1468 1467
1469 int32_t Channel::DeRegisterExternalTransport() { 1468 int32_t Channel::DeRegisterExternalTransport() {
1470 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), 1469 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1471 "Channel::DeRegisterExternalTransport()"); 1470 "Channel::DeRegisterExternalTransport()");
1472 1471
1473 rtc::CritScope cs(&_callbackCritSect); 1472 rtc::CritScope cs(&_callbackCritSect);
1474 1473 if (_transportPtr) {
1475 if (!_transportPtr) { 1474 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1475 "DeRegisterExternalTransport() all transport is disabled");
1476 } else {
1476 _engineStatisticsPtr->SetLastError( 1477 _engineStatisticsPtr->SetLastError(
1477 VE_INVALID_OPERATION, kTraceWarning, 1478 VE_INVALID_OPERATION, kTraceWarning,
1478 "DeRegisterExternalTransport() external transport already " 1479 "DeRegisterExternalTransport() external transport already "
1479 "disabled"); 1480 "disabled");
1480 return 0;
1481 } 1481 }
1482 _externalTransport = false; 1482 _externalTransport = false;
1483 _transportPtr = NULL; 1483 _transportPtr = NULL;
1484 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
1485 "DeRegisterExternalTransport() all transport is disabled");
1486 return 0; 1484 return 0;
1487 } 1485 }
1488 1486
1489 int32_t Channel::ReceivedRTPPacket(const int8_t* data, 1487 int32_t Channel::ReceivedRTPPacket(const uint8_t* received_packet,
1490 size_t length, 1488 size_t length,
1491 const PacketTime& packet_time) { 1489 const PacketTime& packet_time) {
1492 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), 1490 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId),
1493 "Channel::ReceivedRTPPacket()"); 1491 "Channel::ReceivedRTPPacket()");
1494 1492
1495 // Store playout timestamp for the received RTP packet 1493 // Store playout timestamp for the received RTP packet
1496 UpdatePlayoutTimestamp(false); 1494 UpdatePlayoutTimestamp(false);
1497 1495
1498 const uint8_t* received_packet = reinterpret_cast<const uint8_t*>(data);
1499 RTPHeader header; 1496 RTPHeader header;
1500 if (!rtp_header_parser_->Parse(received_packet, length, &header)) { 1497 if (!rtp_header_parser_->Parse(received_packet, length, &header)) {
1501 WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVoice, _channelId, 1498 WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVoice, _channelId,
1502 "Incoming packet: invalid RTP header"); 1499 "Incoming packet: invalid RTP header");
1503 return -1; 1500 return -1;
1504 } 1501 }
1505 header.payload_type_frequency = 1502 header.payload_type_frequency =
1506 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); 1503 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType);
1507 if (header.payload_type_frequency < 0) 1504 if (header.payload_type_frequency < 0)
1508 return -1; 1505 return -1;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 StreamStatistician* statistician = 1575 StreamStatistician* statistician =
1579 rtp_receive_statistics_->GetStatistician(header.ssrc); 1576 rtp_receive_statistics_->GetStatistician(header.ssrc);
1580 if (!statistician) 1577 if (!statistician)
1581 return false; 1578 return false;
1582 // Check if this is a retransmission. 1579 // Check if this is a retransmission.
1583 int64_t min_rtt = 0; 1580 int64_t min_rtt = 0;
1584 _rtpRtcpModule->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL); 1581 _rtpRtcpModule->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL);
1585 return !in_order && statistician->IsRetransmitOfOldPacket(header, min_rtt); 1582 return !in_order && statistician->IsRetransmitOfOldPacket(header, min_rtt);
1586 } 1583 }
1587 1584
1588 int32_t Channel::ReceivedRTCPPacket(const int8_t* data, size_t length) { 1585 int32_t Channel::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
1589 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), 1586 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId),
1590 "Channel::ReceivedRTCPPacket()"); 1587 "Channel::ReceivedRTCPPacket()");
1591 // Store playout timestamp for the received RTCP packet 1588 // Store playout timestamp for the received RTCP packet
1592 UpdatePlayoutTimestamp(true); 1589 UpdatePlayoutTimestamp(true);
1593 1590
1594 // Deliver RTCP packet to RTP/RTCP module for parsing 1591 // Deliver RTCP packet to RTP/RTCP module for parsing
1595 if (_rtpRtcpModule->IncomingRtcpPacket((const uint8_t*)data, length) == -1) { 1592 if (_rtpRtcpModule->IncomingRtcpPacket(data, length) == -1) {
1596 _engineStatisticsPtr->SetLastError( 1593 _engineStatisticsPtr->SetLastError(
1597 VE_SOCKET_TRANSPORT_MODULE_ERROR, kTraceWarning, 1594 VE_SOCKET_TRANSPORT_MODULE_ERROR, kTraceWarning,
1598 "Channel::IncomingRTPPacket() RTCP packet is invalid"); 1595 "Channel::IncomingRTPPacket() RTCP packet is invalid");
1599 } 1596 }
1600 1597
1601 int64_t rtt = GetRTT(true); 1598 int64_t rtt = GetRTT(true);
1602 if (rtt == 0) { 1599 if (rtt == 0) {
1603 // Waiting for valid RTT. 1600 // Waiting for valid RTT.
1604 return 0; 1601 return 0;
1605 } 1602 }
(...skipping 1943 matching lines...) Expand 10 before | Expand all | Expand 10 after
3549 int64_t min_rtt = 0; 3546 int64_t min_rtt = 0;
3550 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3547 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3551 0) { 3548 0) {
3552 return 0; 3549 return 0;
3553 } 3550 }
3554 return rtt; 3551 return rtt;
3555 } 3552 }
3556 3553
3557 } // namespace voe 3554 } // namespace voe
3558 } // namespace webrtc 3555 } // 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