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 |
11 #include "webrtc/video/rtp_video_stream_receiver.h" | 11 #include "webrtc/video/rtp_video_stream_receiver.h" |
12 | 12 |
| 13 #include <utility> |
13 #include <vector> | 14 #include <vector> |
14 #include <utility> | |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/location.h" | 17 #include "webrtc/base/location.h" |
18 #include "webrtc/base/logging.h" | 18 #include "webrtc/base/logging.h" |
19 #include "webrtc/common_types.h" | 19 #include "webrtc/common_types.h" |
20 #include "webrtc/config.h" | 20 #include "webrtc/config.h" |
21 #include "webrtc/media/base/mediaconstants.h" | 21 #include "webrtc/media/base/mediaconstants.h" |
22 #include "webrtc/modules/pacing/packet_router.h" | 22 #include "webrtc/modules/pacing/packet_router.h" |
23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
24 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 24 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 int32_t RtpVideoStreamReceiver::OnReceivedPayloadData( | 232 int32_t RtpVideoStreamReceiver::OnReceivedPayloadData( |
233 const uint8_t* payload_data, | 233 const uint8_t* payload_data, |
234 size_t payload_size, | 234 size_t payload_size, |
235 const WebRtcRTPHeader* rtp_header) { | 235 const WebRtcRTPHeader* rtp_header) { |
236 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header; | 236 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header; |
237 rtp_header_with_ntp.ntp_time_ms = | 237 rtp_header_with_ntp.ntp_time_ms = |
238 ntp_estimator_.Estimate(rtp_header->header.timestamp); | 238 ntp_estimator_.Estimate(rtp_header->header.timestamp); |
239 VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp); | 239 VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp); |
240 packet.timesNacked = | 240 packet.timesNacked = |
241 nack_module_ ? nack_module_->OnReceivedPacket(packet) : -1; | 241 nack_module_ ? nack_module_->OnReceivedPacket(packet) : -1; |
| 242 packet.receive_time_ms = clock_->TimeInMilliseconds(); |
242 | 243 |
243 // In the case of a video stream without picture ids and no rtx the | 244 // In the case of a video stream without picture ids and no rtx the |
244 // RtpFrameReferenceFinder will need to know about padding to | 245 // RtpFrameReferenceFinder will need to know about padding to |
245 // correctly calculate frame references. | 246 // correctly calculate frame references. |
246 if (packet.sizeBytes == 0) { | 247 if (packet.sizeBytes == 0) { |
247 reference_finder_->PaddingReceived(packet.seqNum); | 248 reference_finder_->PaddingReceived(packet.seqNum); |
248 return 0; | 249 return 0; |
249 } | 250 } |
250 | 251 |
251 if (packet.codec == kVideoCodecH264) { | 252 if (packet.codec == kVideoCodecH264) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 513 } |
513 rtp_header.type.Video.codec = payload_specific.Video.videoCodecType; | 514 rtp_header.type.Video.codec = payload_specific.Video.videoCodecType; |
514 rtp_header.type.Video.rotation = kVideoRotation_0; | 515 rtp_header.type.Video.rotation = kVideoRotation_0; |
515 if (header.extension.hasVideoRotation) { | 516 if (header.extension.hasVideoRotation) { |
516 rtp_header.type.Video.rotation = header.extension.videoRotation; | 517 rtp_header.type.Video.rotation = header.extension.videoRotation; |
517 } | 518 } |
518 rtp_header.type.Video.content_type = VideoContentType::UNSPECIFIED; | 519 rtp_header.type.Video.content_type = VideoContentType::UNSPECIFIED; |
519 if (header.extension.hasVideoContentType) { | 520 if (header.extension.hasVideoContentType) { |
520 rtp_header.type.Video.content_type = header.extension.videoContentType; | 521 rtp_header.type.Video.content_type = header.extension.videoContentType; |
521 } | 522 } |
| 523 rtp_header.type.Video.video_timing = {0u, 0u, 0u, 0u, 0u, 0u, false}; |
| 524 if (header.extension.hasVideoTiming) { |
| 525 rtp_header.type.Video.video_timing = header.extension.videoTiming; |
| 526 rtp_header.type.Video.video_timing.is_timing_frame = true; |
| 527 } |
522 rtp_header.type.Video.playout_delay = header.extension.playout_delay; | 528 rtp_header.type.Video.playout_delay = header.extension.playout_delay; |
523 | 529 |
524 OnReceivedPayloadData(nullptr, 0, &rtp_header); | 530 OnReceivedPayloadData(nullptr, 0, &rtp_header); |
525 } | 531 } |
526 | 532 |
527 bool RtpVideoStreamReceiver::DeliverRtcp(const uint8_t* rtcp_packet, | 533 bool RtpVideoStreamReceiver::DeliverRtcp(const uint8_t* rtcp_packet, |
528 size_t rtcp_packet_length) { | 534 size_t rtcp_packet_length) { |
529 { | 535 { |
530 rtc::CritScope lock(&receive_cs_); | 536 rtc::CritScope lock(&receive_cs_); |
531 if (!receiving_) { | 537 if (!receiving_) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 return; | 679 return; |
674 | 680 |
675 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) | 681 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) |
676 return; | 682 return; |
677 | 683 |
678 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), | 684 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), |
679 sprop_decoder.pps_nalu()); | 685 sprop_decoder.pps_nalu()); |
680 } | 686 } |
681 | 687 |
682 } // namespace webrtc | 688 } // namespace webrtc |
OLD | NEW |