| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 if (!receiving_) { | 315 if (!receiving_) { |
| 316 return false; | 316 return false; |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 RTPHeader header; | 320 RTPHeader header; |
| 321 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, | 321 if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, |
| 322 &header)) { | 322 &header)) { |
| 323 return false; | 323 return false; |
| 324 } | 324 } |
| 325 size_t payload_length = rtp_packet_length - header.headerLength; | |
| 326 int64_t arrival_time_ms; | 325 int64_t arrival_time_ms; |
| 327 int64_t now_ms = clock_->TimeInMilliseconds(); | 326 int64_t now_ms = clock_->TimeInMilliseconds(); |
| 328 if (packet_time.timestamp != -1) | 327 if (packet_time.timestamp != -1) |
| 329 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | 328 arrival_time_ms = (packet_time.timestamp + 500) / 1000; |
| 330 else | 329 else |
| 331 arrival_time_ms = now_ms; | 330 arrival_time_ms = now_ms; |
| 332 | 331 |
| 333 { | 332 { |
| 334 // Periodically log the RTP header of incoming packets. | 333 // Periodically log the RTP header of incoming packets. |
| 335 rtc::CritScope lock(&receive_cs_); | 334 rtc::CritScope lock(&receive_cs_); |
| 336 if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) { | 335 if (now_ms - last_packet_log_ms_ > kPacketLogIntervalMs) { |
| 337 std::stringstream ss; | 336 std::stringstream ss; |
| 338 ss << "Packet received on SSRC: " << header.ssrc << " with payload type: " | 337 ss << "Packet received on SSRC: " << header.ssrc << " with payload type: " |
| 339 << static_cast<int>(header.payloadType) << ", timestamp: " | 338 << static_cast<int>(header.payloadType) << ", timestamp: " |
| 340 << header.timestamp << ", sequence number: " << header.sequenceNumber | 339 << header.timestamp << ", sequence number: " << header.sequenceNumber |
| 341 << ", arrival time: " << arrival_time_ms; | 340 << ", arrival time: " << arrival_time_ms; |
| 342 if (header.extension.hasTransmissionTimeOffset) | 341 if (header.extension.hasTransmissionTimeOffset) |
| 343 ss << ", toffset: " << header.extension.transmissionTimeOffset; | 342 ss << ", toffset: " << header.extension.transmissionTimeOffset; |
| 344 if (header.extension.hasAbsoluteSendTime) | 343 if (header.extension.hasAbsoluteSendTime) |
| 345 ss << ", abs send time: " << header.extension.absoluteSendTime; | 344 ss << ", abs send time: " << header.extension.absoluteSendTime; |
| 346 LOG(LS_INFO) << ss.str(); | 345 LOG(LS_INFO) << ss.str(); |
| 347 last_packet_log_ms_ = now_ms; | 346 last_packet_log_ms_ = now_ms; |
| 348 } | 347 } |
| 349 } | 348 } |
| 350 | 349 |
| 351 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_length, | |
| 352 header); | |
| 353 header.payload_type_frequency = kVideoPayloadTypeFrequency; | 350 header.payload_type_frequency = kVideoPayloadTypeFrequency; |
| 354 | 351 |
| 355 bool in_order = IsPacketInOrder(header); | 352 bool in_order = IsPacketInOrder(header); |
| 356 rtp_payload_registry_.SetIncomingPayloadType(header); | 353 rtp_payload_registry_.SetIncomingPayloadType(header); |
| 357 bool ret = ReceivePacket(rtp_packet, rtp_packet_length, header, in_order); | 354 bool ret = ReceivePacket(rtp_packet, rtp_packet_length, header, in_order); |
| 358 // Update receive statistics after ReceivePacket. | 355 // Update receive statistics after ReceivePacket. |
| 359 // Receive statistics will be reset if the payload type changes (make sure | 356 // Receive statistics will be reset if the payload type changes (make sure |
| 360 // that the first packet is included in the stats). | 357 // that the first packet is included in the stats). |
| 361 rtp_receive_statistics_->IncomingPacket( | 358 rtp_receive_statistics_->IncomingPacket( |
| 362 header, rtp_packet_length, IsPacketRetransmitted(header, in_order)); | 359 header, rtp_packet_length, IsPacketRetransmitted(header, in_order)); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 return; | 654 return; |
| 658 | 655 |
| 659 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) | 656 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) |
| 660 return; | 657 return; |
| 661 | 658 |
| 662 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), | 659 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), |
| 663 sprop_decoder.pps_nalu()); | 660 sprop_decoder.pps_nalu()); |
| 664 } | 661 } |
| 665 | 662 |
| 666 } // namespace webrtc | 663 } // namespace webrtc |
| OLD | NEW |