Add RTPVideoHeader::GetAsMetadata().

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}
This commit is contained in:
Henrik Boström
2022-11-25 14:46:40 +01:00
committed by WebRTC LUCI CQ
parent e862da376f
commit 158d5e3078
9 changed files with 123 additions and 47 deletions

View File

@ -12,13 +12,27 @@
namespace webrtc {
RTPVideoHeader::RTPVideoHeader() : video_timing() {}
RTPVideoHeader::RTPVideoHeader(const RTPVideoHeader& other) = default;
RTPVideoHeader::~RTPVideoHeader() = default;
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