philipel | 1a4746a | 2018-07-09 15:52:29 +0200 | [diff] [blame] | 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 | |
philipel | f8d81d3 | 2018-08-01 17:13:08 +0200 | [diff] [blame] | 13 | #include "absl/container/inlined_vector.h" |
philipel | 1a4746a | 2018-07-09 15:52:29 +0200 | [diff] [blame] | 14 | #include "absl/types/variant.h" |
| 15 | #include "api/video/video_content_type.h" |
| 16 | #include "api/video/video_rotation.h" |
| 17 | #include "api/video/video_timing.h" |
| 18 | #include "common_types.h" // NOLINT(build/include) |
| 19 | #include "modules/video_coding/codecs/h264/include/h264_globals.h" |
| 20 | #include "modules/video_coding/codecs/vp8/include/vp8_globals.h" |
| 21 | #include "modules/video_coding/codecs/vp9/include/vp9_globals.h" |
| 22 | |
| 23 | namespace webrtc { |
| 24 | using RTPVideoTypeHeader = |
| 25 | absl::variant<RTPVideoHeaderVP8, RTPVideoHeaderVP9, RTPVideoHeaderH264>; |
| 26 | |
| 27 | struct RTPVideoHeader { |
philipel | bf2b620 | 2018-08-27 14:33:18 +0200 | [diff] [blame] | 28 | struct GenericDescriptorInfo { |
| 29 | GenericDescriptorInfo(); |
| 30 | GenericDescriptorInfo(const GenericDescriptorInfo& other); |
| 31 | ~GenericDescriptorInfo(); |
| 32 | |
| 33 | int64_t frame_id = 0; |
| 34 | int spatial_index = 0; |
| 35 | int temporal_index = 0; |
| 36 | absl::InlinedVector<int64_t, 5> dependencies; |
| 37 | absl::InlinedVector<int, 5> higher_spatial_layers; |
| 38 | }; |
| 39 | |
philipel | 1a4746a | 2018-07-09 15:52:29 +0200 | [diff] [blame] | 40 | RTPVideoHeader(); |
| 41 | RTPVideoHeader(const RTPVideoHeader& other); |
| 42 | |
philipel | f8d81d3 | 2018-08-01 17:13:08 +0200 | [diff] [blame] | 43 | ~RTPVideoHeader(); |
| 44 | |
philipel | 1a4746a | 2018-07-09 15:52:29 +0200 | [diff] [blame] | 45 | // TODO(philipel): Remove when downstream projects have been updated. |
| 46 | RTPVideoHeaderVP8& vp8() { |
| 47 | if (!absl::holds_alternative<RTPVideoHeaderVP8>(video_type_header)) |
| 48 | video_type_header.emplace<RTPVideoHeaderVP8>(); |
| 49 | |
| 50 | return absl::get<RTPVideoHeaderVP8>(video_type_header); |
| 51 | } |
| 52 | // TODO(philipel): Remove when downstream projects have been updated. |
| 53 | const RTPVideoHeaderVP8& vp8() const { |
| 54 | if (!absl::holds_alternative<RTPVideoHeaderVP8>(video_type_header)) |
| 55 | video_type_header.emplace<RTPVideoHeaderVP8>(); |
| 56 | |
| 57 | return absl::get<RTPVideoHeaderVP8>(video_type_header); |
| 58 | } |
philipel | 1a4746a | 2018-07-09 15:52:29 +0200 | [diff] [blame] | 59 | |
philipel | bf2b620 | 2018-08-27 14:33:18 +0200 | [diff] [blame] | 60 | absl::optional<GenericDescriptorInfo> generic; |
philipel | f8d81d3 | 2018-08-01 17:13:08 +0200 | [diff] [blame] | 61 | |
| 62 | uint16_t width = 0; |
| 63 | uint16_t height = 0; |
| 64 | VideoRotation rotation = VideoRotation::kVideoRotation_0; |
| 65 | VideoContentType content_type = VideoContentType::UNSPECIFIED; |
| 66 | bool is_first_packet_in_frame = false; |
| 67 | uint8_t simulcastIdx = 0; |
Kári Tristan Helgason | 55e7785 | 2018-08-27 15:04:07 +0200 | [diff] [blame] | 68 | VideoCodecType codec = VideoCodecType::kVideoCodecGeneric; |
philipel | f8d81d3 | 2018-08-01 17:13:08 +0200 | [diff] [blame] | 69 | |
philipel | 1a4746a | 2018-07-09 15:52:29 +0200 | [diff] [blame] | 70 | PlayoutDelay playout_delay; |
philipel | 1a4746a | 2018-07-09 15:52:29 +0200 | [diff] [blame] | 71 | VideoSendTiming video_timing; |
philipel | 1a4746a | 2018-07-09 15:52:29 +0200 | [diff] [blame] | 72 | // TODO(philipel): remove mutable when downstream projects have been updated. |
| 73 | mutable RTPVideoTypeHeader video_type_header; |
| 74 | }; |
| 75 | |
| 76 | } // namespace webrtc |
| 77 | |
| 78 | #endif // MODULES_RTP_RTCP_SOURCE_RTP_VIDEO_HEADER_H_ |