Index: webrtc/video/rtp_stream_receiver.cc |
diff --git a/webrtc/video/rtp_stream_receiver.cc b/webrtc/video/rtp_stream_receiver.cc |
index d49d0959f32fc826dd3da0cb26d7dda3fe1e0079..1d5aea3822d863d3fc3ba3e3486ef77685d274eb 100644 |
--- a/webrtc/video/rtp_stream_receiver.cc |
+++ b/webrtc/video/rtp_stream_receiver.cc |
@@ -94,6 +94,7 @@ RtpStreamReceiver::RtpStreamReceiver( |
VCMTiming* timing) |
: clock_(Clock::GetRealTimeClock()), |
config_(*config), |
+ rtp_config_(config->rtp.extensions, config->rtp.transport_cc), |
video_receiver_(video_receiver), |
packet_router_(packet_router), |
remb_(remb), |
@@ -242,6 +243,56 @@ RtpReceiver* RtpStreamReceiver::GetRtpReceiver() const { |
return rtp_receiver_.get(); |
} |
+bool RtpStreamReceiver::OnRtpPacket(const RtpPacketReceived& packet) { |
+ { |
+ rtc::CritScope lock(&receive_cs_); |
+ if (!receiving_) { |
+ return false; |
+ } |
+ } |
+ |
+ RTPHeader header; |
+ packet.GetHeader(&header); |
+ |
+ int64_t now_ms = clock_->TimeInMilliseconds(); |
+ |
+ { |
+ // Periodically log the RTP header of incoming packets. |
+ rtc::CritScope lock(&receive_cs_); |
+ if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) { |
+ std::stringstream ss; |
+ ss << "Packet received on SSRC: " << header.ssrc << " with payload type: " |
+ << static_cast<int>(header.payloadType) << ", timestamp: " |
+ << header.timestamp << ", sequence number: " << header.sequenceNumber |
+ << ", arrival time: " << packet.arrival_time_ms(); |
+ if (header.extension.hasTransmissionTimeOffset) |
+ ss << ", toffset: " << header.extension.transmissionTimeOffset; |
+ if (header.extension.hasAbsoluteSendTime) |
+ ss << ", abs send time: " << header.extension.absoluteSendTime; |
+ LOG(LS_INFO) << ss.str(); |
+ last_packet_log_ms_ = now_ms; |
+ } |
+ } |
+ |
+ header.payload_type_frequency = kVideoPayloadTypeFrequency; |
+ |
+ bool in_order = IsPacketInOrder(header); |
+ rtp_payload_registry_.SetIncomingPayloadType(header); |
+ // TODO(nisse): Is .data() and .size() right? Strip headers or not? |
stefan-webrtc
2017/02/09 13:40:06
Yes, this looks correct, as the full packet is nee
|
+ bool ret = ReceivePacket(packet.data(), packet.size(), header, in_order); |
+ // Update receive statistics after ReceivePacket. |
+ // Receive statistics will be reset if the payload type changes (make sure |
+ // that the first packet is included in the stats). |
+ rtp_receive_statistics_->IncomingPacket( |
+ header, packet.size(), IsPacketRetransmitted(header, in_order)); |
+ return ret; |
+} |
+ |
+const RtpPacketReceiver::RtpConfig& RtpStreamReceiver::rtp_config() const { |
+ return rtp_config_; |
+} |
+ |
+ |
int32_t RtpStreamReceiver::OnReceivedPayloadData( |
const uint8_t* payload_data, |
size_t payload_size, |
@@ -316,59 +367,6 @@ void RtpStreamReceiver::OnIncomingSSRCChanged(const uint32_t ssrc) { |
rtp_rtcp_->SetRemoteSSRC(ssrc); |
} |
-bool RtpStreamReceiver::DeliverRtp(const uint8_t* rtp_packet, |
- size_t rtp_packet_length, |
- const PacketTime& packet_time) { |
- { |
- rtc::CritScope lock(&receive_cs_); |
- if (!receiving_) { |
- return false; |
- } |
- } |
- |
- RTPHeader header; |
- if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, |
- &header)) { |
- return false; |
- } |
- int64_t arrival_time_ms; |
- int64_t now_ms = clock_->TimeInMilliseconds(); |
- if (packet_time.timestamp != -1) |
- arrival_time_ms = (packet_time.timestamp + 500) / 1000; |
- else |
- arrival_time_ms = now_ms; |
- |
- { |
- // Periodically log the RTP header of incoming packets. |
- rtc::CritScope lock(&receive_cs_); |
- if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) { |
- std::stringstream ss; |
- ss << "Packet received on SSRC: " << header.ssrc << " with payload type: " |
- << static_cast<int>(header.payloadType) << ", timestamp: " |
- << header.timestamp << ", sequence number: " << header.sequenceNumber |
- << ", arrival time: " << arrival_time_ms; |
- if (header.extension.hasTransmissionTimeOffset) |
- ss << ", toffset: " << header.extension.transmissionTimeOffset; |
- if (header.extension.hasAbsoluteSendTime) |
- ss << ", abs send time: " << header.extension.absoluteSendTime; |
- LOG(LS_INFO) << ss.str(); |
- last_packet_log_ms_ = now_ms; |
- } |
- } |
- |
- header.payload_type_frequency = kVideoPayloadTypeFrequency; |
- |
- bool in_order = IsPacketInOrder(header); |
- rtp_payload_registry_.SetIncomingPayloadType(header); |
- bool ret = ReceivePacket(rtp_packet, rtp_packet_length, header, in_order); |
- // Update receive statistics after ReceivePacket. |
- // Receive statistics will be reset if the payload type changes (make sure |
- // that the first packet is included in the stats). |
- rtp_receive_statistics_->IncomingPacket( |
- header, rtp_packet_length, IsPacketRetransmitted(header, in_order)); |
- return ret; |
-} |
- |
int32_t RtpStreamReceiver::RequestKeyFrame() { |
return rtp_rtcp_->RequestKeyFrame(); |
} |