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

Side by Side Diff: webrtc/modules/video_coding/packet.cc

Issue 2007743003: Add sender controlled playout delay limits (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@cleanup_rtp_hdr_extensions
Patch Set: Addressed comments Created 4 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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 14 matching lines...) Expand all
25 sizeBytes(0), 25 sizeBytes(0),
26 markerBit(false), 26 markerBit(false),
27 timesNacked(-1), 27 timesNacked(-1),
28 frameType(kEmptyFrame), 28 frameType(kEmptyFrame),
29 codec(kVideoCodecUnknown), 29 codec(kVideoCodecUnknown),
30 isFirstPacket(false), 30 isFirstPacket(false),
31 completeNALU(kNaluUnset), 31 completeNALU(kNaluUnset),
32 insertStartCode(false), 32 insertStartCode(false),
33 width(0), 33 width(0),
34 height(0), 34 height(0),
35 codecSpecificHeader() {} 35 video_header() {}
36 36
37 VCMPacket::VCMPacket(const uint8_t* ptr, 37 VCMPacket::VCMPacket(const uint8_t* ptr,
38 const size_t size, 38 const size_t size,
39 const WebRtcRTPHeader& rtpHeader) 39 const WebRtcRTPHeader& rtpHeader)
40 : payloadType(rtpHeader.header.payloadType), 40 : payloadType(rtpHeader.header.payloadType),
41 timestamp(rtpHeader.header.timestamp), 41 timestamp(rtpHeader.header.timestamp),
42 ntp_time_ms_(rtpHeader.ntp_time_ms), 42 ntp_time_ms_(rtpHeader.ntp_time_ms),
43 seqNum(rtpHeader.header.sequenceNumber), 43 seqNum(rtpHeader.header.sequenceNumber),
44 dataPtr(ptr), 44 dataPtr(ptr),
45 sizeBytes(size), 45 sizeBytes(size),
46 markerBit(rtpHeader.header.markerBit), 46 markerBit(rtpHeader.header.markerBit),
47 timesNacked(-1), 47 timesNacked(-1),
48 48
49 frameType(rtpHeader.frameType), 49 frameType(rtpHeader.frameType),
50 codec(kVideoCodecUnknown), 50 codec(kVideoCodecUnknown),
51 isFirstPacket(rtpHeader.type.Video.isFirstPacket), 51 isFirstPacket(rtpHeader.type.Video.isFirstPacket),
52 completeNALU(kNaluComplete), 52 completeNALU(kNaluComplete),
53 insertStartCode(false), 53 insertStartCode(false),
54 width(rtpHeader.type.Video.width), 54 width(rtpHeader.type.Video.width),
55 height(rtpHeader.type.Video.height), 55 height(rtpHeader.type.Video.height),
56 codecSpecificHeader(rtpHeader.type.Video) { 56 video_header(rtpHeader.type.Video) {
57 CopyCodecSpecifics(rtpHeader.type.Video); 57 CopyCodecSpecifics(rtpHeader.type.Video);
58
59 if (markerBit) {
60 video_header.rotation = rtpHeader.type.Video.rotation;
61 }
62 if (isFirstPacket) {
63 video_header.playout_delay = rtpHeader.type.Video.playout_delay;
64 }
58 } 65 }
59 66
60 VCMPacket::VCMPacket(const uint8_t* ptr, 67 VCMPacket::VCMPacket(const uint8_t* ptr,
61 size_t size, 68 size_t size,
62 uint16_t seq, 69 uint16_t seq,
63 uint32_t ts, 70 uint32_t ts,
64 bool mBit) 71 bool mBit)
65 : payloadType(0), 72 : payloadType(0),
66 timestamp(ts), 73 timestamp(ts),
67 ntp_time_ms_(0), 74 ntp_time_ms_(0),
68 seqNum(seq), 75 seqNum(seq),
69 dataPtr(ptr), 76 dataPtr(ptr),
70 sizeBytes(size), 77 sizeBytes(size),
71 markerBit(mBit), 78 markerBit(mBit),
72 timesNacked(-1), 79 timesNacked(-1),
73
74 frameType(kVideoFrameDelta), 80 frameType(kVideoFrameDelta),
75 codec(kVideoCodecUnknown), 81 codec(kVideoCodecUnknown),
76 isFirstPacket(false), 82 isFirstPacket(false),
77 completeNALU(kNaluComplete), 83 completeNALU(kNaluComplete),
78 insertStartCode(false), 84 insertStartCode(false),
79 width(0), 85 width(0),
80 height(0), 86 height(0),
81 codecSpecificHeader() {} 87 video_header() {}
82 88
83 void VCMPacket::Reset() { 89 void VCMPacket::Reset() {
84 payloadType = 0; 90 payloadType = 0;
85 timestamp = 0; 91 timestamp = 0;
86 ntp_time_ms_ = 0; 92 ntp_time_ms_ = 0;
87 seqNum = 0; 93 seqNum = 0;
88 dataPtr = NULL; 94 dataPtr = NULL;
89 sizeBytes = 0; 95 sizeBytes = 0;
90 markerBit = false; 96 markerBit = false;
91 timesNacked = -1; 97 timesNacked = -1;
92 frameType = kEmptyFrame; 98 frameType = kEmptyFrame;
93 codec = kVideoCodecUnknown; 99 codec = kVideoCodecUnknown;
94 isFirstPacket = false; 100 isFirstPacket = false;
95 completeNALU = kNaluUnset; 101 completeNALU = kNaluUnset;
96 insertStartCode = false; 102 insertStartCode = false;
97 width = 0; 103 width = 0;
98 height = 0; 104 height = 0;
99 memset(&codecSpecificHeader, 0, sizeof(RTPVideoHeader)); 105 memset(&video_header, 0, sizeof(RTPVideoHeader));
100 } 106 }
101 107
102 void VCMPacket::CopyCodecSpecifics(const RTPVideoHeader& videoHeader) { 108 void VCMPacket::CopyCodecSpecifics(const RTPVideoHeader& videoHeader) {
103 if (markerBit) {
104 codecSpecificHeader.rotation = videoHeader.rotation;
105 }
106 switch (videoHeader.codec) { 109 switch (videoHeader.codec) {
107 case kRtpVideoVp8: 110 case kRtpVideoVp8:
108 // Handle all packets within a frame as depending on the previous packet 111 // Handle all packets within a frame as depending on the previous packet
109 // TODO(holmer): This should be changed to make fragments independent 112 // TODO(holmer): This should be changed to make fragments independent
110 // when the VP8 RTP receiver supports fragments. 113 // when the VP8 RTP receiver supports fragments.
111 if (isFirstPacket && markerBit) 114 if (isFirstPacket && markerBit)
112 completeNALU = kNaluComplete; 115 completeNALU = kNaluComplete;
113 else if (isFirstPacket) 116 else if (isFirstPacket)
114 completeNALU = kNaluStart; 117 completeNALU = kNaluStart;
115 else if (markerBit) 118 else if (markerBit)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 codec = kVideoCodecH264; 151 codec = kVideoCodecH264;
149 return; 152 return;
150 case kRtpVideoGeneric: 153 case kRtpVideoGeneric:
151 case kRtpVideoNone: 154 case kRtpVideoNone:
152 codec = kVideoCodecUnknown; 155 codec = kVideoCodecUnknown;
153 return; 156 return;
154 } 157 }
155 } 158 }
156 159
157 } // namespace webrtc 160 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698