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