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