niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef MODULES_VIDEO_CODING_PACKET_H_ |
| 12 | #define MODULES_VIDEO_CODING_PACKET_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
| 16 | |
| 17 | #include "absl/types/optional.h" |
Niels Möller | 075e7fd | 2019-03-12 12:29:22 +0100 | [diff] [blame] | 18 | #include "api/rtp_headers.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 19 | #include "common_types.h" // NOLINT(build/include) |
philipel | 2837edc | 2018-10-02 13:55:47 +0200 | [diff] [blame] | 20 | #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 21 | #include "modules/rtp_rtcp/source/rtp_video_header.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 22 | |
pbos@webrtc.org | 3004c79 | 2013-05-07 12:36:21 +0000 | [diff] [blame] | 23 | namespace webrtc { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 24 | |
Niels Möller | 075e7fd | 2019-03-12 12:29:22 +0100 | [diff] [blame] | 25 | // Used to indicate if a received packet contain a complete NALU (or equivalent) |
| 26 | enum VCMNaluCompleteness { |
| 27 | kNaluUnset = 0, // Packet has not been filled. |
| 28 | kNaluComplete = 1, // Packet can be decoded as is. |
| 29 | kNaluStart, // Packet contain beginning of NALU |
| 30 | kNaluIncomplete, // Packet is not beginning or end of NALU |
| 31 | kNaluEnd, // Packet is the end of a NALU |
| 32 | }; |
| 33 | |
pbos@webrtc.org | 3004c79 | 2013-05-07 12:36:21 +0000 | [diff] [blame] | 34 | class VCMPacket { |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 35 | public: |
| 36 | VCMPacket(); |
Niels Möller | 0cb858c | 2019-03-06 14:09:54 +0100 | [diff] [blame] | 37 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 38 | VCMPacket(const uint8_t* ptr, |
Niels Möller | 0cb858c | 2019-03-06 14:09:54 +0100 | [diff] [blame] | 39 | size_t size, |
| 40 | const RTPHeader& rtp_header, |
| 41 | const RTPVideoHeader& video_header, |
Niels Möller | 87e2d78 | 2019-03-07 10:18:23 +0100 | [diff] [blame] | 42 | VideoFrameType frame_type, |
Niels Möller | 0cb858c | 2019-03-06 14:09:54 +0100 | [diff] [blame] | 43 | int64_t ntp_time_ms); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | |
philipel | 2837edc | 2018-10-02 13:55:47 +0200 | [diff] [blame] | 45 | ~VCMPacket(); |
| 46 | |
Niels Möller | d5e02f0 | 2019-02-20 13:12:21 +0100 | [diff] [blame] | 47 | VideoCodecType codec() const { return video_header.codec; } |
| 48 | int width() const { return video_header.width; } |
| 49 | int height() const { return video_header.height; } |
| 50 | |
| 51 | bool is_first_packet_in_frame() const { |
| 52 | return video_header.is_first_packet_in_frame; |
| 53 | } |
| 54 | bool is_last_packet_in_frame() const { |
| 55 | return video_header.is_last_packet_in_frame; |
| 56 | } |
| 57 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 58 | uint8_t payloadType; |
| 59 | uint32_t timestamp; |
| 60 | // NTP time of the capture time in local timebase in milliseconds. |
| 61 | int64_t ntp_time_ms_; |
| 62 | uint16_t seqNum; |
| 63 | const uint8_t* dataPtr; |
| 64 | size_t sizeBytes; |
| 65 | bool markerBit; |
philipel | 5ceaaae | 2016-05-24 10:20:47 +0200 | [diff] [blame] | 66 | int timesNacked; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 67 | |
Niels Möller | 87e2d78 | 2019-03-07 10:18:23 +0100 | [diff] [blame] | 68 | VideoFrameType frameType; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 69 | |
philipel | 9d3ab61 | 2015-12-21 04:12:39 -0800 | [diff] [blame] | 70 | VCMNaluCompleteness completeNALU; // Default is kNaluIncomplete. |
| 71 | bool insertStartCode; // True if a start code should be inserted before this |
| 72 | // packet. |
isheriff | 6b4b5f3 | 2016-06-08 00:24:21 -0700 | [diff] [blame] | 73 | RTPVideoHeader video_header; |
philipel | 2837edc | 2018-10-02 13:55:47 +0200 | [diff] [blame] | 74 | absl::optional<RtpGenericFrameDescriptor> generic_descriptor; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 75 | |
ilnik | 04f4d12 | 2017-06-19 07:18:55 -0700 | [diff] [blame] | 76 | int64_t receive_time_ms; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 77 | }; |
| 78 | |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 79 | } // namespace webrtc |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 80 | #endif // MODULES_VIDEO_CODING_PACKET_H_ |