packet.h (2511B)
1 /* 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MODULES_VIDEO_CODING_DEPRECATED_PACKET_H_ 12 #define MODULES_VIDEO_CODING_DEPRECATED_PACKET_H_ 13 14 #include <stddef.h> 15 #include <stdint.h> 16 17 #include <optional> 18 19 #include "api/rtp_headers.h" 20 #include "api/rtp_packet_info.h" 21 #include "api/units/timestamp.h" 22 #include "api/video/video_codec_type.h" 23 #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h" 24 #include "modules/rtp_rtcp/source/rtp_video_header.h" 25 26 namespace webrtc { 27 28 // Used to indicate if a received packet contain a complete NALU (or equivalent) 29 enum VCMNaluCompleteness { 30 kNaluUnset = 0, // Packet has not been filled. 31 kNaluComplete = 1, // Packet can be decoded as is. 32 kNaluStart, // Packet contain beginning of NALU 33 kNaluIncomplete, // Packet is not beginning or end of NALU 34 kNaluEnd, // Packet is the end of a NALU 35 }; 36 37 class VCMPacket { 38 public: 39 VCMPacket(); 40 41 VCMPacket(const uint8_t* ptr, 42 size_t size, 43 const RTPHeader& rtp_header, 44 const RTPVideoHeader& video_header, 45 int64_t ntp_time_ms, 46 Timestamp receive_time); 47 48 ~VCMPacket(); 49 50 VideoCodecType codec() const { return video_header.codec; } 51 int width() const { return video_header.width; } 52 int height() const { return video_header.height; } 53 54 bool is_first_packet_in_frame() const { 55 return video_header.is_first_packet_in_frame; 56 } 57 bool is_last_packet_in_frame() const { 58 return video_header.is_last_packet_in_frame; 59 } 60 61 uint8_t payloadType; 62 uint32_t timestamp; 63 // NTP time of the capture time in local timebase in milliseconds. 64 int64_t ntp_time_ms_; 65 uint16_t seqNum; 66 const uint8_t* dataPtr; 67 size_t sizeBytes; 68 bool markerBit; 69 int timesNacked; 70 71 VCMNaluCompleteness completeNALU; // Default is kNaluIncomplete. 72 bool insertStartCode; // True if a start code should be inserted before this 73 // packet. 74 RTPVideoHeader video_header; 75 std::optional<RtpGenericFrameDescriptor> generic_descriptor; 76 77 RtpPacketInfo packet_info; 78 }; 79 80 } // namespace webrtc 81 #endif // MODULES_VIDEO_CODING_DEPRECATED_PACKET_H_