mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-16 15:20:42 +01:00

This will allow exposing VP8, VP9 and H264-specific RTP header metadata in JavaScript (behind a flag). This information appears to be necessary for cloning (https://github.com/w3c/webrtc-encoded-transform/issues/161), and cloning should be the same as "new frame + setMetadata + setBytes", ergo this should be exposed. Bug: webrtc:14709 Change-Id: Ie71c05f40689bbd529dc4674a07a87c7910b22d5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290880 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39101}
61 lines
2.2 KiB
C++
61 lines
2.2 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.SetFrameType(frame_type);
|
|
metadata.SetWidth(width);
|
|
metadata.SetHeight(height);
|
|
metadata.SetRotation(rotation);
|
|
metadata.SetContentType(content_type);
|
|
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);
|
|
}
|
|
metadata.SetIsLastFrameInPicture(is_last_frame_in_picture);
|
|
metadata.SetSimulcastIdx(simulcastIdx);
|
|
metadata.SetCodec(codec);
|
|
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;
|
|
}
|
|
return metadata;
|
|
}
|
|
|
|
} // namespace webrtc
|