OLD | NEW |
---|---|
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 |
11 #include "webrtc/modules/video_coding/packet.h" | 11 #include "webrtc/modules/video_coding/packet.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 | 14 |
15 #include "webrtc/modules/include/module_common_types.h" | 15 #include "webrtc/modules/include/module_common_types.h" |
16 | 16 |
17 namespace webrtc { | 17 namespace webrtc { |
18 | 18 |
19 VCMPacket::VCMPacket() | 19 VCMPacket::VCMPacket() |
20 : payloadType(0), | 20 : payloadType(0), |
21 timestamp(0), | 21 timestamp(0), |
22 ntp_time_ms_(0), | 22 ntp_time_ms_(0), |
23 seqNum(0), | 23 seqNum(0), |
24 dataPtr(NULL), | 24 dataPtr(NULL), |
25 sizeBytes(0), | 25 sizeBytes(0), |
26 markerBit(false), | 26 markerBit(false), |
27 timesNacked(-1), | |
terelius
2016/05/23 11:49:55
Why does a newly constructed (that has not been na
philipel
2016/05/23 13:34:17
-1 mean we don't know, so 0 can mean 0.
| |
27 frameType(kEmptyFrame), | 28 frameType(kEmptyFrame), |
28 codec(kVideoCodecUnknown), | 29 codec(kVideoCodecUnknown), |
29 isFirstPacket(false), | 30 isFirstPacket(false), |
30 completeNALU(kNaluUnset), | 31 completeNALU(kNaluUnset), |
31 insertStartCode(false), | 32 insertStartCode(false), |
32 width(0), | 33 width(0), |
33 height(0), | 34 height(0), |
34 codecSpecificHeader() {} | 35 codecSpecificHeader() {} |
35 | 36 |
36 VCMPacket::VCMPacket(const uint8_t* ptr, | 37 VCMPacket::VCMPacket(const uint8_t* ptr, |
37 const size_t size, | 38 const size_t size, |
38 const WebRtcRTPHeader& rtpHeader) | 39 const WebRtcRTPHeader& rtpHeader) |
39 : payloadType(rtpHeader.header.payloadType), | 40 : payloadType(rtpHeader.header.payloadType), |
40 timestamp(rtpHeader.header.timestamp), | 41 timestamp(rtpHeader.header.timestamp), |
41 ntp_time_ms_(rtpHeader.ntp_time_ms), | 42 ntp_time_ms_(rtpHeader.ntp_time_ms), |
42 seqNum(rtpHeader.header.sequenceNumber), | 43 seqNum(rtpHeader.header.sequenceNumber), |
43 dataPtr(ptr), | 44 dataPtr(ptr), |
44 sizeBytes(size), | 45 sizeBytes(size), |
45 markerBit(rtpHeader.header.markerBit), | 46 markerBit(rtpHeader.header.markerBit), |
47 timesNacked(-1), | |
46 | 48 |
47 frameType(rtpHeader.frameType), | 49 frameType(rtpHeader.frameType), |
48 codec(kVideoCodecUnknown), | 50 codec(kVideoCodecUnknown), |
49 isFirstPacket(rtpHeader.type.Video.isFirstPacket), | 51 isFirstPacket(rtpHeader.type.Video.isFirstPacket), |
50 completeNALU(kNaluComplete), | 52 completeNALU(kNaluComplete), |
51 insertStartCode(false), | 53 insertStartCode(false), |
52 width(rtpHeader.type.Video.width), | 54 width(rtpHeader.type.Video.width), |
53 height(rtpHeader.type.Video.height), | 55 height(rtpHeader.type.Video.height), |
54 codecSpecificHeader(rtpHeader.type.Video) { | 56 codecSpecificHeader(rtpHeader.type.Video) { |
55 CopyCodecSpecifics(rtpHeader.type.Video); | 57 CopyCodecSpecifics(rtpHeader.type.Video); |
56 } | 58 } |
57 | 59 |
58 VCMPacket::VCMPacket(const uint8_t* ptr, | 60 VCMPacket::VCMPacket(const uint8_t* ptr, |
59 size_t size, | 61 size_t size, |
60 uint16_t seq, | 62 uint16_t seq, |
61 uint32_t ts, | 63 uint32_t ts, |
62 bool mBit) | 64 bool mBit) |
63 : payloadType(0), | 65 : payloadType(0), |
64 timestamp(ts), | 66 timestamp(ts), |
65 ntp_time_ms_(0), | 67 ntp_time_ms_(0), |
66 seqNum(seq), | 68 seqNum(seq), |
67 dataPtr(ptr), | 69 dataPtr(ptr), |
68 sizeBytes(size), | 70 sizeBytes(size), |
69 markerBit(mBit), | 71 markerBit(mBit), |
72 timesNacked(-1), | |
70 | 73 |
71 frameType(kVideoFrameDelta), | 74 frameType(kVideoFrameDelta), |
72 codec(kVideoCodecUnknown), | 75 codec(kVideoCodecUnknown), |
73 isFirstPacket(false), | 76 isFirstPacket(false), |
74 completeNALU(kNaluComplete), | 77 completeNALU(kNaluComplete), |
75 insertStartCode(false), | 78 insertStartCode(false), |
76 width(0), | 79 width(0), |
77 height(0), | 80 height(0), |
78 codecSpecificHeader() {} | 81 codecSpecificHeader() {} |
79 | 82 |
80 void VCMPacket::Reset() { | 83 void VCMPacket::Reset() { |
81 payloadType = 0; | 84 payloadType = 0; |
82 timestamp = 0; | 85 timestamp = 0; |
83 ntp_time_ms_ = 0; | 86 ntp_time_ms_ = 0; |
84 seqNum = 0; | 87 seqNum = 0; |
85 dataPtr = NULL; | 88 dataPtr = NULL; |
86 sizeBytes = 0; | 89 sizeBytes = 0; |
87 markerBit = false; | 90 markerBit = false; |
91 timesNacked = -1; | |
88 frameType = kEmptyFrame; | 92 frameType = kEmptyFrame; |
89 codec = kVideoCodecUnknown; | 93 codec = kVideoCodecUnknown; |
90 isFirstPacket = false; | 94 isFirstPacket = false; |
91 completeNALU = kNaluUnset; | 95 completeNALU = kNaluUnset; |
92 insertStartCode = false; | 96 insertStartCode = false; |
93 width = 0; | 97 width = 0; |
94 height = 0; | 98 height = 0; |
95 memset(&codecSpecificHeader, 0, sizeof(RTPVideoHeader)); | 99 memset(&codecSpecificHeader, 0, sizeof(RTPVideoHeader)); |
96 } | 100 } |
97 | 101 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 codec = kVideoCodecH264; | 148 codec = kVideoCodecH264; |
145 return; | 149 return; |
146 case kRtpVideoGeneric: | 150 case kRtpVideoGeneric: |
147 case kRtpVideoNone: | 151 case kRtpVideoNone: |
148 codec = kVideoCodecUnknown; | 152 codec = kVideoCodecUnknown; |
149 return; | 153 return; |
150 } | 154 } |
151 } | 155 } |
152 | 156 |
153 } // namespace webrtc | 157 } // namespace webrtc |
OLD | NEW |