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