xref: /aosp_15_r20/external/webrtc/modules/rtp_rtcp/source/rtp_video_header.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 
11 #include "modules/rtp_rtcp/source/rtp_video_header.h"
12 
13 namespace webrtc {
14 
15 RTPVideoHeader::GenericDescriptorInfo::GenericDescriptorInfo() = default;
16 RTPVideoHeader::GenericDescriptorInfo::GenericDescriptorInfo(
17     const GenericDescriptorInfo& other) = default;
18 RTPVideoHeader::GenericDescriptorInfo::~GenericDescriptorInfo() = default;
19 
RTPVideoHeader()20 RTPVideoHeader::RTPVideoHeader() : video_timing() {}
21 RTPVideoHeader::RTPVideoHeader(const RTPVideoHeader& other) = default;
22 RTPVideoHeader::~RTPVideoHeader() = default;
23 
GetAsMetadata() const24 VideoFrameMetadata RTPVideoHeader::GetAsMetadata() const {
25   VideoFrameMetadata metadata;
26   metadata.SetFrameType(frame_type);
27   metadata.SetWidth(width);
28   metadata.SetHeight(height);
29   metadata.SetRotation(rotation);
30   metadata.SetContentType(content_type);
31   if (generic) {
32     metadata.SetFrameId(generic->frame_id);
33     metadata.SetSpatialIndex(generic->spatial_index);
34     metadata.SetTemporalIndex(generic->temporal_index);
35     metadata.SetFrameDependencies(generic->dependencies);
36     metadata.SetDecodeTargetIndications(generic->decode_target_indications);
37   }
38   metadata.SetIsLastFrameInPicture(is_last_frame_in_picture);
39   metadata.SetSimulcastIdx(simulcastIdx);
40   metadata.SetCodec(codec);
41   return metadata;
42 }
43 
44 }  // namespace webrtc
45