frame_object.h 2.3 KB

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