Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: webrtc/video/rtp_stream_receiver.cc

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Fix capture timestamp issues which cause capture time from the future Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_stream_receiver.h" 11 #include "webrtc/video/rtp_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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 int32_t RtpStreamReceiver::OnReceivedPayloadData( 231 int32_t RtpStreamReceiver::OnReceivedPayloadData(
232 const uint8_t* payload_data, 232 const uint8_t* payload_data,
233 size_t payload_size, 233 size_t payload_size,
234 const WebRtcRTPHeader* rtp_header) { 234 const WebRtcRTPHeader* rtp_header) {
235 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header; 235 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header;
236 rtp_header_with_ntp.ntp_time_ms = 236 rtp_header_with_ntp.ntp_time_ms =
237 ntp_estimator_.Estimate(rtp_header->header.timestamp); 237 ntp_estimator_.Estimate(rtp_header->header.timestamp);
238 VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp); 238 VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp);
239 packet.timesNacked = 239 packet.timesNacked =
240 nack_module_ ? nack_module_->OnReceivedPacket(packet) : -1; 240 nack_module_ ? nack_module_->OnReceivedPacket(packet) : -1;
241 packet.receive_time_ms = clock_->TimeInMilliseconds();
241 242
242 // In the case of a video stream without picture ids and no rtx the 243 // In the case of a video stream without picture ids and no rtx the
243 // RtpFrameReferenceFinder will need to know about padding to 244 // RtpFrameReferenceFinder will need to know about padding to
244 // correctly calculate frame references. 245 // correctly calculate frame references.
245 if (packet.sizeBytes == 0) { 246 if (packet.sizeBytes == 0) {
246 reference_finder_->PaddingReceived(packet.seqNum); 247 reference_finder_->PaddingReceived(packet.seqNum);
247 return 0; 248 return 0;
248 } 249 }
249 250
250 if (packet.codec == kVideoCodecH264) { 251 if (packet.codec == kVideoCodecH264) {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 514 }
514 rtp_header.type.Video.codec = payload_specific.Video.videoCodecType; 515 rtp_header.type.Video.codec = payload_specific.Video.videoCodecType;
515 rtp_header.type.Video.rotation = kVideoRotation_0; 516 rtp_header.type.Video.rotation = kVideoRotation_0;
516 if (header.extension.hasVideoRotation) { 517 if (header.extension.hasVideoRotation) {
517 rtp_header.type.Video.rotation = header.extension.videoRotation; 518 rtp_header.type.Video.rotation = header.extension.videoRotation;
518 } 519 }
519 rtp_header.type.Video.content_type = VideoContentType::UNSPECIFIED; 520 rtp_header.type.Video.content_type = VideoContentType::UNSPECIFIED;
520 if (header.extension.hasVideoContentType) { 521 if (header.extension.hasVideoContentType) {
521 rtp_header.type.Video.content_type = header.extension.videoContentType; 522 rtp_header.type.Video.content_type = header.extension.videoContentType;
522 } 523 }
524 rtp_header.type.Video.video_timing = {0u, 0u, 0u, 0u, 0u, false};
525 if (header.extension.hasVideoTiming) {
526 rtp_header.type.Video.video_timing = header.extension.videoTiming;
527 rtp_header.type.Video.video_timing.is_timing_frame = true;
528 }
523 rtp_header.type.Video.playout_delay = header.extension.playout_delay; 529 rtp_header.type.Video.playout_delay = header.extension.playout_delay;
524 530
525 OnReceivedPayloadData(nullptr, 0, &rtp_header); 531 OnReceivedPayloadData(nullptr, 0, &rtp_header);
526 } 532 }
527 533
528 bool RtpStreamReceiver::DeliverRtcp(const uint8_t* rtcp_packet, 534 bool RtpStreamReceiver::DeliverRtcp(const uint8_t* rtcp_packet,
529 size_t rtcp_packet_length) { 535 size_t rtcp_packet_length) {
530 { 536 {
531 rtc::CritScope lock(&receive_cs_); 537 rtc::CritScope lock(&receive_cs_);
532 if (!receiving_) { 538 if (!receiving_) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 return; 680 return;
675 681
676 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str())) 682 if (!sprop_decoder.DecodeSprop(sprop_base64_it->second.c_str()))
677 return; 683 return;
678 684
679 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(), 685 tracker_.InsertSpsPpsNalus(sprop_decoder.sps_nalu(),
680 sprop_decoder.pps_nalu()); 686 sprop_decoder.pps_nalu());
681 } 687 }
682 688
683 } // namespace webrtc 689 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698