rtp_video_header.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (c) 2018 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_RTP_RTCP_SOURCE_RTP_VIDEO_HEADER_H_
  11. #define MODULES_RTP_RTCP_SOURCE_RTP_VIDEO_HEADER_H_
  12. #include <bitset>
  13. #include <cstdint>
  14. #include "absl/container/inlined_vector.h"
  15. #include "absl/types/optional.h"
  16. #include "absl/types/variant.h"
  17. #include "api/transport/rtp/dependency_descriptor.h"
  18. #include "api/video/color_space.h"
  19. #include "api/video/video_codec_type.h"
  20. #include "api/video/video_content_type.h"
  21. #include "api/video/video_frame_type.h"
  22. #include "api/video/video_rotation.h"
  23. #include "api/video/video_timing.h"
  24. #include "modules/video_coding/codecs/h264/include/h264_globals.h"
  25. #include "modules/video_coding/codecs/vp8/include/vp8_globals.h"
  26. #include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
  27. namespace webrtc {
  28. // Details passed in the rtp payload for legacy generic rtp packetizer.
  29. // TODO(bugs.webrtc.org/9772): Deprecate in favor of passing generic video
  30. // details in an rtp header extension.
  31. struct RTPVideoHeaderLegacyGeneric {
  32. uint16_t picture_id;
  33. };
  34. using RTPVideoTypeHeader = absl::variant<absl::monostate,
  35. RTPVideoHeaderVP8,
  36. RTPVideoHeaderVP9,
  37. RTPVideoHeaderH264,
  38. RTPVideoHeaderLegacyGeneric>;
  39. struct RTPVideoHeader {
  40. struct GenericDescriptorInfo {
  41. GenericDescriptorInfo();
  42. GenericDescriptorInfo(const GenericDescriptorInfo& other);
  43. ~GenericDescriptorInfo();
  44. int64_t frame_id = 0;
  45. int spatial_index = 0;
  46. int temporal_index = 0;
  47. absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications;
  48. absl::InlinedVector<int64_t, 5> dependencies;
  49. absl::InlinedVector<int, 4> chain_diffs;
  50. std::bitset<32> active_decode_targets = ~uint32_t{0};
  51. };
  52. RTPVideoHeader();
  53. RTPVideoHeader(const RTPVideoHeader& other);
  54. ~RTPVideoHeader();
  55. absl::optional<GenericDescriptorInfo> generic;
  56. VideoFrameType frame_type = VideoFrameType::kEmptyFrame;
  57. uint16_t width = 0;
  58. uint16_t height = 0;
  59. VideoRotation rotation = VideoRotation::kVideoRotation_0;
  60. VideoContentType content_type = VideoContentType::UNSPECIFIED;
  61. bool is_first_packet_in_frame = false;
  62. bool is_last_packet_in_frame = false;
  63. uint8_t simulcastIdx = 0;
  64. VideoCodecType codec = VideoCodecType::kVideoCodecGeneric;
  65. VideoPlayoutDelay playout_delay;
  66. VideoSendTiming video_timing;
  67. absl::optional<ColorSpace> color_space;
  68. RTPVideoTypeHeader video_type_header;
  69. };
  70. } // namespace webrtc
  71. #endif // MODULES_RTP_RTCP_SOURCE_RTP_VIDEO_HEADER_H_