tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

frame_object.h (3105B)


      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_RTP_RTCP_SOURCE_FRAME_OBJECT_H_
     12 #define MODULES_RTP_RTCP_SOURCE_FRAME_OBJECT_H_
     13 
     14 #include <cstdint>
     15 #include <optional>
     16 #include <vector>
     17 
     18 #include "api/rtp_packet_infos.h"
     19 #include "api/scoped_refptr.h"
     20 #include "api/video/color_space.h"
     21 #include "api/video/corruption_detection/frame_instrumentation_data.h"
     22 #include "api/video/encoded_frame.h"
     23 #include "api/video/encoded_image.h"
     24 #include "api/video/video_codec_type.h"
     25 #include "api/video/video_content_type.h"
     26 #include "api/video/video_frame_metadata.h"
     27 #include "api/video/video_frame_type.h"
     28 #include "api/video/video_rotation.h"
     29 #include "api/video/video_timing.h"
     30 #include "modules/rtp_rtcp/source/rtp_video_header.h"
     31 
     32 namespace webrtc {
     33 
     34 class RtpFrameObject : public EncodedFrame {
     35 public:
     36  RtpFrameObject(
     37      uint16_t first_seq_num,
     38      uint16_t last_seq_num,
     39      bool markerBit,
     40      int times_nacked,
     41      int64_t first_packet_received_time,
     42      int64_t last_packet_received_time,
     43      uint32_t rtp_timestamp,
     44      int64_t ntp_time_ms,
     45      const VideoSendTiming& timing,
     46      uint8_t payload_type,
     47      VideoCodecType codec,
     48      VideoRotation rotation,
     49      VideoContentType content_type,
     50      const RTPVideoHeader& video_header,
     51      const std::optional<class ColorSpace>& color_space,
     52      const std::optional<FrameInstrumentationData>& frame_instrumentation_data,
     53      RtpPacketInfos packet_infos,
     54      scoped_refptr<EncodedImageBuffer> image_buffer);
     55 
     56  ~RtpFrameObject() override;
     57  uint16_t first_seq_num() const;
     58  uint16_t last_seq_num() const;
     59  int times_nacked() const;
     60  VideoFrameType frame_type() const;
     61  VideoCodecType codec_type() const;
     62  int64_t ReceivedTime() const override;
     63  int64_t RenderTime() const override;
     64  bool delayed_by_retransmission() const override;
     65  const RTPVideoHeader& GetRtpVideoHeader() const;
     66 
     67  uint8_t* mutable_data() { return image_buffer_->data(); }
     68 
     69  const std::vector<uint32_t>& Csrcs() const { return csrcs_; }
     70 
     71  void SetFirstSeqNum(uint16_t first_seq_num) {
     72    first_seq_num_ = first_seq_num;
     73  }
     74  void SetLastSeqNum(uint16_t last_seq_num) { last_seq_num_ = last_seq_num; }
     75  void SetHeaderFromMetadata(const VideoFrameMetadata& metadata);
     76 
     77 private:
     78  // Reference for mutable access.
     79  scoped_refptr<EncodedImageBuffer> image_buffer_;
     80  RTPVideoHeader rtp_video_header_;
     81  VideoCodecType codec_type_;
     82  uint16_t first_seq_num_;
     83  uint16_t last_seq_num_;
     84  int64_t last_packet_received_time_;
     85  std::vector<uint32_t> csrcs_;
     86 
     87  // Equal to times nacked of the packet with the highet times nacked
     88  // belonging to this frame.
     89  int times_nacked_;
     90 };
     91 
     92 }  // namespace webrtc
     93 
     94 #endif  // MODULES_RTP_RTCP_SOURCE_FRAME_OBJECT_H_