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