| 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 video_header.playout_delay = {-1, -1}; |
| 37 } |
| 36 | 38 |
| 37 VCMPacket::VCMPacket(const uint8_t* ptr, | 39 VCMPacket::VCMPacket(const uint8_t* ptr, |
| 38 const size_t size, | 40 const size_t size, |
| 39 const WebRtcRTPHeader& rtpHeader) | 41 const WebRtcRTPHeader& rtpHeader) |
| 40 : payloadType(rtpHeader.header.payloadType), | 42 : payloadType(rtpHeader.header.payloadType), |
| 41 timestamp(rtpHeader.header.timestamp), | 43 timestamp(rtpHeader.header.timestamp), |
| 42 ntp_time_ms_(rtpHeader.ntp_time_ms), | 44 ntp_time_ms_(rtpHeader.ntp_time_ms), |
| 43 seqNum(rtpHeader.header.sequenceNumber), | 45 seqNum(rtpHeader.header.sequenceNumber), |
| 44 dataPtr(ptr), | 46 dataPtr(ptr), |
| 45 sizeBytes(size), | 47 sizeBytes(size), |
| 46 markerBit(rtpHeader.header.markerBit), | 48 markerBit(rtpHeader.header.markerBit), |
| 47 timesNacked(-1), | 49 timesNacked(-1), |
| 48 | |
| 49 frameType(rtpHeader.frameType), | 50 frameType(rtpHeader.frameType), |
| 50 codec(kVideoCodecUnknown), | 51 codec(kVideoCodecUnknown), |
| 51 isFirstPacket(rtpHeader.type.Video.isFirstPacket), | 52 isFirstPacket(rtpHeader.type.Video.isFirstPacket), |
| 52 completeNALU(kNaluComplete), | 53 completeNALU(kNaluComplete), |
| 53 insertStartCode(false), | 54 insertStartCode(false), |
| 54 width(rtpHeader.type.Video.width), | 55 width(rtpHeader.type.Video.width), |
| 55 height(rtpHeader.type.Video.height), | 56 height(rtpHeader.type.Video.height), |
| 56 codecSpecificHeader(rtpHeader.type.Video) { | 57 video_header(rtpHeader.type.Video) { |
| 57 CopyCodecSpecifics(rtpHeader.type.Video); | 58 CopyCodecSpecifics(rtpHeader.type.Video); |
| 59 |
| 60 if (markerBit) { |
| 61 video_header.rotation = rtpHeader.type.Video.rotation; |
| 62 } |
| 63 // Playout decisions are made entirely based on first packet in a frame. |
| 64 if (isFirstPacket) { |
| 65 video_header.playout_delay = rtpHeader.type.Video.playout_delay; |
| 66 } else { |
| 67 video_header.playout_delay = {-1, -1}; |
| 68 } |
| 58 } | 69 } |
| 59 | 70 |
| 60 VCMPacket::VCMPacket(const uint8_t* ptr, | 71 VCMPacket::VCMPacket(const uint8_t* ptr, |
| 61 size_t size, | 72 size_t size, |
| 62 uint16_t seq, | 73 uint16_t seq, |
| 63 uint32_t ts, | 74 uint32_t ts, |
| 64 bool mBit) | 75 bool mBit) |
| 65 : payloadType(0), | 76 : payloadType(0), |
| 66 timestamp(ts), | 77 timestamp(ts), |
| 67 ntp_time_ms_(0), | 78 ntp_time_ms_(0), |
| 68 seqNum(seq), | 79 seqNum(seq), |
| 69 dataPtr(ptr), | 80 dataPtr(ptr), |
| 70 sizeBytes(size), | 81 sizeBytes(size), |
| 71 markerBit(mBit), | 82 markerBit(mBit), |
| 72 timesNacked(-1), | 83 timesNacked(-1), |
| 73 | |
| 74 frameType(kVideoFrameDelta), | 84 frameType(kVideoFrameDelta), |
| 75 codec(kVideoCodecUnknown), | 85 codec(kVideoCodecUnknown), |
| 76 isFirstPacket(false), | 86 isFirstPacket(false), |
| 77 completeNALU(kNaluComplete), | 87 completeNALU(kNaluComplete), |
| 78 insertStartCode(false), | 88 insertStartCode(false), |
| 79 width(0), | 89 width(0), |
| 80 height(0), | 90 height(0), |
| 81 codecSpecificHeader() {} | 91 video_header() {} |
| 82 | 92 |
| 83 void VCMPacket::Reset() { | 93 void VCMPacket::Reset() { |
| 84 payloadType = 0; | 94 payloadType = 0; |
| 85 timestamp = 0; | 95 timestamp = 0; |
| 86 ntp_time_ms_ = 0; | 96 ntp_time_ms_ = 0; |
| 87 seqNum = 0; | 97 seqNum = 0; |
| 88 dataPtr = NULL; | 98 dataPtr = NULL; |
| 89 sizeBytes = 0; | 99 sizeBytes = 0; |
| 90 markerBit = false; | 100 markerBit = false; |
| 91 timesNacked = -1; | 101 timesNacked = -1; |
| 92 frameType = kEmptyFrame; | 102 frameType = kEmptyFrame; |
| 93 codec = kVideoCodecUnknown; | 103 codec = kVideoCodecUnknown; |
| 94 isFirstPacket = false; | 104 isFirstPacket = false; |
| 95 completeNALU = kNaluUnset; | 105 completeNALU = kNaluUnset; |
| 96 insertStartCode = false; | 106 insertStartCode = false; |
| 97 width = 0; | 107 width = 0; |
| 98 height = 0; | 108 height = 0; |
| 99 memset(&codecSpecificHeader, 0, sizeof(RTPVideoHeader)); | 109 memset(&video_header, 0, sizeof(RTPVideoHeader)); |
| 100 } | 110 } |
| 101 | 111 |
| 102 void VCMPacket::CopyCodecSpecifics(const RTPVideoHeader& videoHeader) { | 112 void VCMPacket::CopyCodecSpecifics(const RTPVideoHeader& videoHeader) { |
| 103 if (markerBit) { | |
| 104 codecSpecificHeader.rotation = videoHeader.rotation; | |
| 105 } | |
| 106 switch (videoHeader.codec) { | 113 switch (videoHeader.codec) { |
| 107 case kRtpVideoVp8: | 114 case kRtpVideoVp8: |
| 108 // Handle all packets within a frame as depending on the previous packet | 115 // Handle all packets within a frame as depending on the previous packet |
| 109 // TODO(holmer): This should be changed to make fragments independent | 116 // TODO(holmer): This should be changed to make fragments independent |
| 110 // when the VP8 RTP receiver supports fragments. | 117 // when the VP8 RTP receiver supports fragments. |
| 111 if (isFirstPacket && markerBit) | 118 if (isFirstPacket && markerBit) |
| 112 completeNALU = kNaluComplete; | 119 completeNALU = kNaluComplete; |
| 113 else if (isFirstPacket) | 120 else if (isFirstPacket) |
| 114 completeNALU = kNaluStart; | 121 completeNALU = kNaluStart; |
| 115 else if (markerBit) | 122 else if (markerBit) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 codec = kVideoCodecH264; | 155 codec = kVideoCodecH264; |
| 149 return; | 156 return; |
| 150 case kRtpVideoGeneric: | 157 case kRtpVideoGeneric: |
| 151 case kRtpVideoNone: | 158 case kRtpVideoNone: |
| 152 codec = kVideoCodecUnknown; | 159 codec = kVideoCodecUnknown; |
| 153 return; | 160 return; |
| 154 } | 161 } |
| 155 } | 162 } |
| 156 | 163 |
| 157 } // namespace webrtc | 164 } // namespace webrtc |
| OLD | NEW |