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

Side by Side Diff: voice_engine/channel.cc

Issue 3016543002: Remove VoENetwork (Closed)
Patch Set: rebase Created 3 years, 2 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
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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 _engineStatisticsPtr->SetLastError( 1355 _engineStatisticsPtr->SetLastError(
1356 VE_INVALID_OPERATION, kTraceWarning, 1356 VE_INVALID_OPERATION, kTraceWarning,
1357 "DeRegisterExternalTransport() external transport already " 1357 "DeRegisterExternalTransport() external transport already "
1358 "disabled"); 1358 "disabled");
1359 } 1359 }
1360 _externalTransport = false; 1360 _externalTransport = false;
1361 _transportPtr = NULL; 1361 _transportPtr = NULL;
1362 return 0; 1362 return 0;
1363 } 1363 }
1364 1364
1365 // TODO(nisse): Delete this method together with ReceivedRTPPacket.
1366 // It's a temporary hack to support both ReceivedRTPPacket and
1367 // OnRtpPacket interfaces without too much code duplication.
1368 bool Channel::OnRtpPacketWithHeader(const uint8_t* received_packet,
1369 size_t length,
1370 RTPHeader *header) {
1371 // Store playout timestamp for the received RTP packet
1372 UpdatePlayoutTimestamp(false);
1373
1374 header->payload_type_frequency =
1375 rtp_payload_registry_->GetPayloadTypeFrequency(header->payloadType);
1376 if (header->payload_type_frequency < 0)
1377 return false;
1378 bool in_order = IsPacketInOrder(*header);
1379 rtp_receive_statistics_->IncomingPacket(
1380 *header, length, IsPacketRetransmitted(*header, in_order));
1381 rtp_payload_registry_->SetIncomingPayloadType(*header);
1382
1383 return ReceivePacket(received_packet, length, *header, in_order);
1384 }
1385
1386 int32_t Channel::ReceivedRTPPacket(const uint8_t* received_packet,
1387 size_t length,
1388 const PacketTime& packet_time) {
1389 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId),
1390 "Channel::ReceivedRTPPacket()");
1391
1392 RTPHeader header;
1393 if (!rtp_header_parser_->Parse(received_packet, length, &header)) {
1394 WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVoice, _channelId,
1395 "Incoming packet: invalid RTP header");
1396 return -1;
1397 }
1398 return OnRtpPacketWithHeader(received_packet, length, &header) ? 0 : -1;
1399 }
1400
1401 void Channel::OnRtpPacket(const RtpPacketReceived& packet) { 1365 void Channel::OnRtpPacket(const RtpPacketReceived& packet) {
1402 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), 1366 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId),
1403 "Channel::ReceivedRTPPacket()"); 1367 "Channel::OnRtpPacket()");
1404 1368
1405 RTPHeader header; 1369 RTPHeader header;
1406 packet.GetHeader(&header); 1370 packet.GetHeader(&header);
1407 OnRtpPacketWithHeader(packet.data(), packet.size(), &header); 1371
1372 // Store playout timestamp for the received RTP packet
1373 UpdatePlayoutTimestamp(false);
1374
1375 header.payload_type_frequency =
1376 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType);
1377 if (header.payload_type_frequency >= 0) {
1378 bool in_order = IsPacketInOrder(header);
1379 rtp_receive_statistics_->IncomingPacket(
1380 header, packet.size(), IsPacketRetransmitted(header, in_order));
1381 rtp_payload_registry_->SetIncomingPayloadType(header);
1382
1383 ReceivePacket(packet.data(), packet.size(), header, in_order);
1384 }
1408 } 1385 }
1409 1386
1410 bool Channel::ReceivePacket(const uint8_t* packet, 1387 bool Channel::ReceivePacket(const uint8_t* packet,
1411 size_t packet_length, 1388 size_t packet_length,
1412 const RTPHeader& header, 1389 const RTPHeader& header,
1413 bool in_order) { 1390 bool in_order) {
1414 const uint8_t* payload = packet + header.headerLength; 1391 const uint8_t* payload = packet + header.headerLength;
1415 assert(packet_length >= header.headerLength); 1392 assert(packet_length >= header.headerLength);
1416 size_t payload_length = packet_length - header.headerLength; 1393 size_t payload_length = packet_length - header.headerLength;
1417 PayloadUnion payload_specific; 1394 PayloadUnion payload_specific;
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 int64_t min_rtt = 0; 2083 int64_t min_rtt = 0;
2107 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 2084 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
2108 0) { 2085 0) {
2109 return 0; 2086 return 0;
2110 } 2087 }
2111 return rtt; 2088 return rtt;
2112 } 2089 }
2113 2090
2114 } // namespace voe 2091 } // namespace voe
2115 } // namespace webrtc 2092 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698