2018-07-09 15:52:29 +02:00
|
|
|
/*
|
|
|
|
|
* 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 {
|
|
|
|
|
|
2018-08-27 14:33:18 +02:00
|
|
|
RTPVideoHeader::GenericDescriptorInfo::GenericDescriptorInfo() = default;
|
|
|
|
|
RTPVideoHeader::GenericDescriptorInfo::GenericDescriptorInfo(
|
|
|
|
|
const GenericDescriptorInfo& other) = default;
|
|
|
|
|
RTPVideoHeader::GenericDescriptorInfo::~GenericDescriptorInfo() = default;
|
|
|
|
|
|
2022-11-25 14:46:40 +01:00
|
|
|
RTPVideoHeader::RTPVideoHeader() : video_timing() {}
|
|
|
|
|
RTPVideoHeader::RTPVideoHeader(const RTPVideoHeader& other) = default;
|
|
|
|
|
RTPVideoHeader::~RTPVideoHeader() = default;
|
|
|
|
|
|
|
|
|
|
VideoFrameMetadata RTPVideoHeader::GetAsMetadata() const {
|
|
|
|
|
VideoFrameMetadata metadata;
|
2022-11-29 12:04:14 +01:00
|
|
|
metadata.SetFrameType(frame_type);
|
2022-11-25 14:46:40 +01:00
|
|
|
metadata.SetWidth(width);
|
|
|
|
|
metadata.SetHeight(height);
|
2022-11-29 12:04:14 +01:00
|
|
|
metadata.SetRotation(rotation);
|
|
|
|
|
metadata.SetContentType(content_type);
|
2022-11-25 14:46:40 +01:00
|
|
|
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);
|
|
|
|
|
}
|
2022-11-29 12:04:14 +01:00
|
|
|
metadata.SetIsLastFrameInPicture(is_last_frame_in_picture);
|
|
|
|
|
metadata.SetSimulcastIdx(simulcastIdx);
|
|
|
|
|
metadata.SetCodec(codec);
|
2023-01-11 12:16:36 +01:00
|
|
|
switch (codec) {
|
|
|
|
|
case VideoCodecType::kVideoCodecVP8:
|
|
|
|
|
metadata.SetRTPVideoHeaderCodecSpecifics(
|
|
|
|
|
absl::get<RTPVideoHeaderVP8>(video_type_header));
|
|
|
|
|
break;
|
|
|
|
|
case VideoCodecType::kVideoCodecVP9:
|
|
|
|
|
metadata.SetRTPVideoHeaderCodecSpecifics(
|
|
|
|
|
absl::get<RTPVideoHeaderVP9>(video_type_header));
|
|
|
|
|
break;
|
|
|
|
|
case VideoCodecType::kVideoCodecH264:
|
|
|
|
|
metadata.SetRTPVideoHeaderCodecSpecifics(
|
|
|
|
|
absl::get<RTPVideoHeaderH264>(video_type_header));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
// Codec-specifics are not supported for this codec.
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-11-25 14:46:40 +01:00
|
|
|
return metadata;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-09 15:52:29 +02:00
|
|
|
} // namespace webrtc
|