blob: 944aed53dd2decb1dc191082f8e0b5e3e743df80 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_VIDEO_CODING_PACKET_H_
12#define MODULES_VIDEO_CODING_PACKET_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
Yves Gerey3e707812018-11-28 16:47:49 +010014#include <stddef.h>
15#include <stdint.h>
16
17#include "absl/types/optional.h"
18#include "common_types.h" // NOLINT(build/include)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "modules/include/module_common_types.h"
philipel2837edc2018-10-02 13:55:47 +020020#include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h"
Yves Gerey3e707812018-11-28 16:47:49 +010021#include "modules/rtp_rtcp/source/rtp_video_header.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000022
pbos@webrtc.org3004c792013-05-07 12:36:21 +000023namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:25 +000024
pbos@webrtc.org3004c792013-05-07 12:36:21 +000025class VCMPacket {
philipel9d3ab612015-12-21 04:12:39 -080026 public:
27 VCMPacket();
Niels Möller0cb858c2019-03-06 14:09:54 +010028
29 VCMPacket(const uint8_t* ptr, size_t size, const WebRtcRTPHeader& rtpHeader);
30
philipel9d3ab612015-12-21 04:12:39 -080031 VCMPacket(const uint8_t* ptr,
Niels Möller0cb858c2019-03-06 14:09:54 +010032 size_t size,
33 const RTPHeader& rtp_header,
34 const RTPVideoHeader& video_header,
35 FrameType frame_type,
36 int64_t ntp_time_ms);
niklase@google.com470e71d2011-07-07 08:21:25 +000037
philipel2837edc2018-10-02 13:55:47 +020038 ~VCMPacket();
39
Niels Möllerd5e02f02019-02-20 13:12:21 +010040 VideoCodecType codec() const { return video_header.codec; }
41 int width() const { return video_header.width; }
42 int height() const { return video_header.height; }
43
44 bool is_first_packet_in_frame() const {
45 return video_header.is_first_packet_in_frame;
46 }
47 bool is_last_packet_in_frame() const {
48 return video_header.is_last_packet_in_frame;
49 }
50
philipel9d3ab612015-12-21 04:12:39 -080051 uint8_t payloadType;
52 uint32_t timestamp;
53 // NTP time of the capture time in local timebase in milliseconds.
54 int64_t ntp_time_ms_;
55 uint16_t seqNum;
56 const uint8_t* dataPtr;
57 size_t sizeBytes;
58 bool markerBit;
philipel5ceaaae2016-05-24 10:20:47 +020059 int timesNacked;
niklase@google.com470e71d2011-07-07 08:21:25 +000060
philipel9d3ab612015-12-21 04:12:39 -080061 FrameType frameType;
niklase@google.com470e71d2011-07-07 08:21:25 +000062
philipel9d3ab612015-12-21 04:12:39 -080063 VCMNaluCompleteness completeNALU; // Default is kNaluIncomplete.
64 bool insertStartCode; // True if a start code should be inserted before this
65 // packet.
isheriff6b4b5f32016-06-08 00:24:21 -070066 RTPVideoHeader video_header;
philipel2837edc2018-10-02 13:55:47 +020067 absl::optional<RtpGenericFrameDescriptor> generic_descriptor;
niklase@google.com470e71d2011-07-07 08:21:25 +000068
ilnik04f4d122017-06-19 07:18:55 -070069 int64_t receive_time_ms;
niklase@google.com470e71d2011-07-07 08:21:25 +000070};
71
pbos@webrtc.orgd900e8b2013-07-03 15:12:26 +000072} // namespace webrtc
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020073#endif // MODULES_VIDEO_CODING_PACKET_H_