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 13 #include <bitset> 14 #include <cstdint> 15 16 #include "absl/container/inlined_vector.h" 17 #include "absl/types/optional.h" 18 #include "absl/types/variant.h" 19 #include "api/transport/rtp/dependency_descriptor.h" 20 #include "api/video/color_space.h" 21 #include "api/video/video_codec_type.h" 22 #include "api/video/video_content_type.h" 23 #include "api/video/video_frame_type.h" 24 #include "api/video/video_rotation.h" 25 #include "api/video/video_timing.h" 26 #include "modules/video_coding/codecs/h264/include/h264_globals.h" 27 #ifndef DISABLE_H265 28 #include "modules/video_coding/codecs/h265/include/h265_globals.h" 29 #endif 30 #include "modules/video_coding/codecs/vp8/include/vp8_globals.h" 31 #include "modules/video_coding/codecs/vp9/include/vp9_globals.h" 32 33 namespace webrtc { 34 // Details passed in the rtp payload for legacy generic rtp packetizer. 35 // TODO(bugs.webrtc.org/9772): Deprecate in favor of passing generic video 36 // details in an rtp header extension. 37 struct RTPVideoHeaderLegacyGeneric { 38 uint16_t picture_id; 39 }; 40 41 #ifndef DISABLE_H265 42 using RTPVideoTypeHeader = absl::variant<absl::monostate, 43 RTPVideoHeaderVP8, 44 RTPVideoHeaderVP9, 45 RTPVideoHeaderH264, 46 RTPVideoHeaderH265, 47 RTPVideoHeaderLegacyGeneric>; 48 #else 49 using RTPVideoTypeHeader = absl::variant<absl::monostate, 50 RTPVideoHeaderVP8, 51 RTPVideoHeaderVP9, 52 RTPVideoHeaderH264, 53 RTPVideoHeaderLegacyGeneric>; 54 #endif 55 56 struct RTPVideoHeader { 57 struct GenericDescriptorInfo { 58 GenericDescriptorInfo(); 59 GenericDescriptorInfo(const GenericDescriptorInfo& other); 60 ~GenericDescriptorInfo(); 61 62 int64_t frame_id = 0; 63 int spatial_index = 0; 64 int temporal_index = 0; 65 absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications; 66 absl::InlinedVector<int64_t, 5> dependencies; 67 absl::InlinedVector<int, 4> chain_diffs; 68 std::bitset<32> active_decode_targets = ~uint32_t{0}; 69 }; 70 71 RTPVideoHeader(); 72 RTPVideoHeader(const RTPVideoHeader& other); 73 74 ~RTPVideoHeader(); 75 76 absl::optional<GenericDescriptorInfo> generic; 77 78 VideoFrameType frame_type = VideoFrameType::kEmptyFrame; 79 uint16_t width = 0; 80 uint16_t height = 0; 81 VideoRotation rotation = VideoRotation::kVideoRotation_0; 82 VideoContentType content_type = VideoContentType::UNSPECIFIED; 83 bool is_first_packet_in_frame = false; 84 bool is_last_packet_in_frame = false; 85 bool is_last_frame_in_picture = true; 86 uint8_t simulcastIdx = 0; 87 VideoCodecType codec = VideoCodecType::kVideoCodecGeneric; 88 89 VideoPlayoutDelay playout_delay; 90 VideoSendTiming video_timing; 91 absl::optional<ColorSpace> color_space; 92 // This field is meant for media quality testing purpose only. When enabled it 93 // carries the webrtc::VideoFrame id field from the sender to the receiver. 94 absl::optional<uint16_t> video_frame_tracking_id; 95 RTPVideoTypeHeader video_type_header; 96 }; 97 98 } // namespace webrtc 99 100 #endif // MODULES_RTP_RTCP_SOURCE_RTP_VIDEO_HEADER_H_ 101