Index: webrtc/voice_engine/channel.cc |
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
index d69654fb0f2451f1a5e49564f63ef90a32056aff..16f752cb273bbc33d368ab50a0d26d96f81217e7 100644 |
--- a/webrtc/voice_engine/channel.cc |
+++ b/webrtc/voice_engine/channel.cc |
@@ -32,6 +32,7 @@ |
#include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
#include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
#include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
+#include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" |
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" |
#include "webrtc/modules/utility/include/process_thread.h" |
#include "webrtc/system_wrappers/include/trace.h" |
@@ -1551,31 +1552,49 @@ int32_t Channel::DeRegisterExternalTransport() { |
return 0; |
} |
+// TODO(nisse): Delete this method together with ReceivedRTPPacket. |
+// It's a temporary hack to support both ReceivedRTPPacket and |
+// OnRtpPacket interfaces without too much code duplication. |
+bool Channel::OnRtpPacketWithHeader(const uint8_t* received_packet, |
+ size_t length, |
+ RTPHeader *header) { |
+ // Store playout timestamp for the received RTP packet |
+ UpdatePlayoutTimestamp(false); |
+ |
+ header->payload_type_frequency = |
+ rtp_payload_registry_->GetPayloadTypeFrequency(header->payloadType); |
+ if (header->payload_type_frequency < 0) |
+ return false; |
+ bool in_order = IsPacketInOrder(*header); |
+ rtp_receive_statistics_->IncomingPacket( |
+ *header, length, IsPacketRetransmitted(*header, in_order)); |
+ rtp_payload_registry_->SetIncomingPayloadType(*header); |
+ |
+ return ReceivePacket(received_packet, length, *header, in_order); |
+} |
+ |
int32_t Channel::ReceivedRTPPacket(const uint8_t* received_packet, |
size_t length, |
const PacketTime& packet_time) { |
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), |
"Channel::ReceivedRTPPacket()"); |
- // Store playout timestamp for the received RTP packet |
- UpdatePlayoutTimestamp(false); |
- |
RTPHeader header; |
if (!rtp_header_parser_->Parse(received_packet, length, &header)) { |
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVoice, _channelId, |
"Incoming packet: invalid RTP header"); |
return -1; |
} |
- header.payload_type_frequency = |
- rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); |
- if (header.payload_type_frequency < 0) |
- return -1; |
- bool in_order = IsPacketInOrder(header); |
- rtp_receive_statistics_->IncomingPacket( |
- header, length, IsPacketRetransmitted(header, in_order)); |
- rtp_payload_registry_->SetIncomingPayloadType(header); |
+ return OnRtpPacketWithHeader(received_packet, length, &header) ? 0 : -1; |
+} |
- return ReceivePacket(received_packet, length, header, in_order) ? 0 : -1; |
+void Channel::OnRtpPacket(const RtpPacketReceived& packet) { |
+ WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), |
+ "Channel::ReceivedRTPPacket()"); |
+ |
+ RTPHeader header; |
+ packet.GetHeader(&header); |
+ OnRtpPacketWithHeader(packet.data(), packet.size(), &header); |
} |
bool Channel::ReceivePacket(const uint8_t* packet, |