BlueGit

ict rusty-teams

Files

rusty-teams / vendor / webrtc-sys / include / livekit / packet_trailer_av1.h

packet_trailer_av1.h

packet_trailer_av1.h 1.8 KiB Download Raw
1/*
2 * Copyright 2026 LiveKit, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <cstdint>
20#include <optional>
21#include <span>
22#include <vector>
23
24#include "api/frame_transformer_interface.h"
25#include "livekit/packet_trailer.h"
26
27namespace livekit_ffi {
28namespace av1 {
29
30/// Returns true if the frame's MIME type identifies it as AV1.
31bool IsAv1Frame(const webrtc::TransformableFrameInterface& frame);
32
33/// Inserts a LiveKit packet-trailer metadata OBU into an AV1 temporal unit.
34///
35/// `trailer` is the already-built TLV trailer payload (see
36/// [`PacketTrailerTransformer`]). The OBU is placed after any temporal
37/// delimiter and sequence header OBUs so it is not mistaken for frame data.
38std::vector<uint8_t> InsertTrailerObu(
39 std::span<const uint8_t> data,
40 std::span<const uint8_t> trailer);
41
42/// Extracts and removes a LiveKit packet-trailer metadata OBU from an AV1
43/// temporal unit.
44///
45/// On success the parsed metadata is returned and `out_data` receives the
46/// frame data with the metadata OBU removed. Otherwise `out_data` receives
47/// an unchanged copy of `data` and `std::nullopt` is returned.
48std::optional<PacketTrailerMetadata> ExtractTrailer(
49 std::span<const uint8_t> data,
50 std::vector<uint8_t>& out_data);
51
52} // namespace av1
53} // namespace livekit_ffi