OLD | NEW |
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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 if (!receiving_) { | 329 if (!receiving_) { |
330 return false; | 330 return false; |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 RTPHeader header; | 334 RTPHeader header; |
335 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, | 335 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, |
336 &header)) { | 336 &header)) { |
337 return false; | 337 return false; |
338 } | 338 } |
339 size_t payload_length = rtp_packet_length - header.headerLength; | |
340 int64_t arrival_time_ms; | 339 int64_t arrival_time_ms; |
341 int64_t now_ms = clock_->TimeInMilliseconds(); | 340 int64_t now_ms = clock_->TimeInMilliseconds(); |
342 if (packet_time.timestamp != -1) | 341 if (packet_time.timestamp != -1) |
343 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | 342 arrival_time_ms = (packet_time.timestamp + 500) / 1000; |
344 else | 343 else |
345 arrival_time_ms = now_ms; | 344 arrival_time_ms = now_ms; |
346 | 345 |
347 { | 346 { |
348 // Periodically log the RTP header of incoming packets. | 347 // Periodically log the RTP header of incoming packets. |
349 rtc::CritScope lock(&receive_cs_); | 348 rtc::CritScope lock(&receive_cs_); |
350 if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) { | 349 if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) { |
351 std::stringstream ss; | 350 std::stringstream ss; |
352 ss << "Packet received on SSRC: " << header.ssrc << " with payload type: " | 351 ss << "Packet received on SSRC: " << header.ssrc << " with payload type: " |
353 << static_cast<int>(header.payloadType) << ", timestamp: " | 352 << static_cast<int>(header.payloadType) << ", timestamp: " |
354 << header.timestamp << ", sequence number: " << header.sequenceNumber | 353 << header.timestamp << ", sequence number: " << header.sequenceNumber |
355 << ", arrival time: " << arrival_time_ms; | 354 << ", arrival time: " << arrival_time_ms; |
356 if (header.extension.hasTransmissionTimeOffset) | 355 if (header.extension.hasTransmissionTimeOffset) |
357 ss << ", toffset: " << header.extension.transmissionTimeOffset; | 356 ss << ", toffset: " << header.extension.transmissionTimeOffset; |
358 if (header.extension.hasAbsoluteSendTime) | 357 if (header.extension.hasAbsoluteSendTime) |
359 ss << ", abs send time: " << header.extension.absoluteSendTime; | 358 ss << ", abs send time: " << header.extension.absoluteSendTime; |
360 LOG(LS_INFO) << ss.str(); | 359 LOG(LS_INFO) << ss.str(); |
361 last_packet_log_ms_ = now_ms; | 360 last_packet_log_ms_ = now_ms; |
362 } | 361 } |
363 } | 362 } |
364 | 363 |
365 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_length, | |
366 header); | |
367 header.payload_type_frequency = kVideoPayloadTypeFrequency; | 364 header.payload_type_frequency = kVideoPayloadTypeFrequency; |
368 | 365 |
369 bool in_order = IsPacketInOrder(header); | 366 bool in_order = IsPacketInOrder(header); |
370 rtp_payload_registry_.SetIncomingPayloadType(header); | 367 rtp_payload_registry_.SetIncomingPayloadType(header); |
371 bool ret = ReceivePacket(rtp_packet, rtp_packet_length, header, in_order); | 368 bool ret = ReceivePacket(rtp_packet, rtp_packet_length, header, in_order); |
372 // Update receive statistics after ReceivePacket. | 369 // Update receive statistics after ReceivePacket. |
373 // Receive statistics will be reset if the payload type changes (make sure | 370 // Receive statistics will be reset if the payload type changes (make sure |
374 // that the first packet is included in the stats). | 371 // that the first packet is included in the stats). |
375 rtp_receive_statistics_->IncomingPacket( | 372 rtp_receive_statistics_->IncomingPacket( |
376 header, rtp_packet_length, IsPacketRetransmitted(header, in_order)); | 373 header, rtp_packet_length, IsPacketRetransmitted(header, in_order)); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 return; | 673 return; |
677 | 674 |
678 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) | 675 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) |
679 return; | 676 return; |
680 | 677 |
681 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), | 678 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), |
682 sprop_decoder.pps_nalu()); | 679 sprop_decoder.pps_nalu()); |
683 } | 680 } |
684 | 681 |
685 } // namespace webrtc | 682 } // namespace webrtc |
OLD | NEW |