In preparation of adding RTPVideoHeader::SetFromMetadata() method, the VideoFrameMetadata construct-from-RTPVideoHeader is replaced by RTPVideoHeader::GetAsMetadata(). This serves two purposes: 1. Having "GetAs" and "SetFrom" in the same file reduces the risk of these two methods getting out of sync as we expand its usage. 2. This is necessary to avoid a circular dependency that would otherwise be introduced by RTPVideoHeader::SetFromMetadata(). Bug: webrtc:14709 Change-Id: I127b3d15f9a8c6af210449a5a50d414c9ba79930 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285080 Reviewed-by: Tony Herre <herre@google.com> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38735}
39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "modules/rtp_rtcp/source/rtp_video_header.h"
|
|
|
|
namespace webrtc {
|
|
|
|
RTPVideoHeader::GenericDescriptorInfo::GenericDescriptorInfo() = default;
|
|
RTPVideoHeader::GenericDescriptorInfo::GenericDescriptorInfo(
|
|
const GenericDescriptorInfo& other) = default;
|
|
RTPVideoHeader::GenericDescriptorInfo::~GenericDescriptorInfo() = default;
|
|
|
|
RTPVideoHeader::RTPVideoHeader() : video_timing() {}
|
|
RTPVideoHeader::RTPVideoHeader(const RTPVideoHeader& other) = default;
|
|
RTPVideoHeader::~RTPVideoHeader() = default;
|
|
|
|
VideoFrameMetadata RTPVideoHeader::GetAsMetadata() const {
|
|
VideoFrameMetadata metadata;
|
|
metadata.SetWidth(width);
|
|
metadata.SetHeight(height);
|
|
if (generic) {
|
|
metadata.SetFrameId(generic->frame_id);
|
|
metadata.SetSpatialIndex(generic->spatial_index);
|
|
metadata.SetTemporalIndex(generic->temporal_index);
|
|
metadata.SetFrameDependencies(generic->dependencies);
|
|
metadata.SetDecodeTargetIndications(generic->decode_target_indications);
|
|
}
|
|
return metadata;
|
|
}
|
|
|
|
} // namespace webrtc
|