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

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

Issue 2688473004: RtpPacketReceiver base class and OnRtpPacket, with a pre-parsed RTP packet. (Closed)
Patch Set: Created 3 years, 10 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 14 matching lines...) Expand all
25 #include "webrtc/config.h" 25 #include "webrtc/config.h"
26 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 26 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
27 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" 27 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
28 #include "webrtc/modules/audio_device/include/audio_device.h" 28 #include "webrtc/modules/audio_device/include/audio_device.h"
29 #include "webrtc/modules/audio_processing/include/audio_processing.h" 29 #include "webrtc/modules/audio_processing/include/audio_processing.h"
30 #include "webrtc/modules/include/module_common_types.h" 30 #include "webrtc/modules/include/module_common_types.h"
31 #include "webrtc/modules/pacing/packet_router.h" 31 #include "webrtc/modules/pacing/packet_router.h"
32 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" 32 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
33 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" 33 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
34 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 34 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
35 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
35 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" 36 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
36 #include "webrtc/modules/utility/include/process_thread.h" 37 #include "webrtc/modules/utility/include/process_thread.h"
37 #include "webrtc/system_wrappers/include/trace.h" 38 #include "webrtc/system_wrappers/include/trace.h"
38 #include "webrtc/voice_engine/include/voe_external_media.h" 39 #include "webrtc/voice_engine/include/voe_external_media.h"
39 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" 40 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
40 #include "webrtc/voice_engine/output_mixer.h" 41 #include "webrtc/voice_engine/output_mixer.h"
41 #include "webrtc/voice_engine/statistics.h" 42 #include "webrtc/voice_engine/statistics.h"
42 #include "webrtc/voice_engine/transmit_mixer.h" 43 #include "webrtc/voice_engine/transmit_mixer.h"
43 #include "webrtc/voice_engine/utility.h" 44 #include "webrtc/voice_engine/utility.h"
44 45
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 _engineStatisticsPtr->SetLastError( 1628 _engineStatisticsPtr->SetLastError(
1628 VE_INVALID_OPERATION, kTraceWarning, 1629 VE_INVALID_OPERATION, kTraceWarning,
1629 "DeRegisterExternalTransport() external transport already " 1630 "DeRegisterExternalTransport() external transport already "
1630 "disabled"); 1631 "disabled");
1631 } 1632 }
1632 _externalTransport = false; 1633 _externalTransport = false;
1633 _transportPtr = NULL; 1634 _transportPtr = NULL;
1634 return 0; 1635 return 0;
1635 } 1636 }
1636 1637
1637 int32_t Channel::ReceivedRTPPacket(const uint8_t* received_packet, 1638 int32_t Channel::OnRTPPacket(const RtpPacketReceived& packet) {
1638 size_t length,
1639 const PacketTime& packet_time) {
1640 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), 1639 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId),
1641 "Channel::ReceivedRTPPacket()"); 1640 "Channel::ReceivedRTPPacket()");
1642 1641
1643 // Store playout timestamp for the received RTP packet 1642 // Store playout timestamp for the received RTP packet
1644 UpdatePlayoutTimestamp(false); 1643 UpdatePlayoutTimestamp(false);
1645 1644
1646 RTPHeader header; 1645 RTPHeader header;
1647 if (!rtp_header_parser_->Parse(received_packet, length, &header)) { 1646 packet.GetHeader(&header);
1648 WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVoice, _channelId,
1649 "Incoming packet: invalid RTP header");
1650 return -1;
1651 }
1652 header.payload_type_frequency = 1647 header.payload_type_frequency =
1653 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); 1648 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType);
1654 if (header.payload_type_frequency < 0) 1649 if (header.payload_type_frequency < 0)
1655 return -1; 1650 return -1;
1656 bool in_order = IsPacketInOrder(header); 1651 bool in_order = IsPacketInOrder(header);
1657 rtp_receive_statistics_->IncomingPacket( 1652 rtp_receive_statistics_->IncomingPacket(
1658 header, length, IsPacketRetransmitted(header, in_order)); 1653 header, packet.size(), IsPacketRetransmitted(header, in_order));
1659 rtp_payload_registry_->SetIncomingPayloadType(header); 1654 rtp_payload_registry_->SetIncomingPayloadType(header);
1660 1655
1661 return ReceivePacket(received_packet, length, header, in_order) ? 0 : -1; 1656 // TODO(nisse): Is .data() and .size() right?
1657 return ReceivePacket(packet.data(), packet.size(), header, in_order) ? 0 : -1;
1662 } 1658 }
1663 1659
1664 bool Channel::ReceivePacket(const uint8_t* packet, 1660 bool Channel::ReceivePacket(const uint8_t* packet,
1665 size_t packet_length, 1661 size_t packet_length,
1666 const RTPHeader& header, 1662 const RTPHeader& header,
1667 bool in_order) { 1663 bool in_order) {
1668 if (rtp_payload_registry_->IsRtx(header)) { 1664 if (rtp_payload_registry_->IsRtx(header)) {
1669 return HandleRtxPacket(packet, packet_length, header); 1665 return HandleRtxPacket(packet, packet_length, header);
1670 } 1666 }
1671 const uint8_t* payload = packet + header.headerLength; 1667 const uint8_t* payload = packet + header.headerLength;
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after
3324 int64_t min_rtt = 0; 3320 int64_t min_rtt = 0;
3325 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3321 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3326 0) { 3322 0) {
3327 return 0; 3323 return 0;
3328 } 3324 }
3329 return rtt; 3325 return rtt;
3330 } 3326 }
3331 3327
3332 } // namespace voe 3328 } // namespace voe
3333 } // namespace webrtc 3329 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698