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