xref: /aosp_15_r20/external/webrtc/modules/video_coding/frame_object.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2016 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_FRAME_OBJECT_H_
12 #define MODULES_VIDEO_CODING_FRAME_OBJECT_H_
13 
14 #include "absl/types/optional.h"
15 #include "api/video/encoded_frame.h"
16 
17 namespace webrtc {
18 
19 class RtpFrameObject : public EncodedFrame {
20  public:
21   RtpFrameObject(uint16_t first_seq_num,
22                  uint16_t last_seq_num,
23                  bool markerBit,
24                  int times_nacked,
25                  int64_t first_packet_received_time,
26                  int64_t last_packet_received_time,
27                  uint32_t rtp_timestamp,
28                  int64_t ntp_time_ms,
29                  const VideoSendTiming& timing,
30                  uint8_t payload_type,
31                  VideoCodecType codec,
32                  VideoRotation rotation,
33                  VideoContentType content_type,
34                  const RTPVideoHeader& video_header,
35                  const absl::optional<webrtc::ColorSpace>& color_space,
36                  RtpPacketInfos packet_infos,
37                  rtc::scoped_refptr<EncodedImageBuffer> image_buffer);
38 
39   ~RtpFrameObject() override;
40   uint16_t first_seq_num() const;
41   uint16_t last_seq_num() const;
42   int times_nacked() const;
43   VideoFrameType frame_type() const;
44   VideoCodecType codec_type() const;
45   int64_t ReceivedTime() const override;
46   int64_t RenderTime() const override;
47   bool delayed_by_retransmission() const override;
48   const RTPVideoHeader& GetRtpVideoHeader() const;
49 
mutable_data()50   uint8_t* mutable_data() { return image_buffer_->data(); }
51 
52  private:
53   // Reference for mutable access.
54   rtc::scoped_refptr<EncodedImageBuffer> image_buffer_;
55   RTPVideoHeader rtp_video_header_;
56   VideoCodecType codec_type_;
57   uint16_t first_seq_num_;
58   uint16_t last_seq_num_;
59   int64_t last_packet_received_time_;
60 
61   // Equal to times nacked of the packet with the highet times nacked
62   // belonging to this frame.
63   int times_nacked_;
64 };
65 
66 }  // namespace webrtc
67 
68 #endif  // MODULES_VIDEO_CODING_FRAME_OBJECT_H_
69