LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
data_track_frame.h
1/*
2 * Copyright 2026 LiveKit
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 <vector>
22
23namespace livekit {
24
25namespace proto {
26class DataTrackFrame;
27} // namespace proto
28
38 std::vector<std::uint8_t> payload;
39
46 std::optional<std::uint64_t> user_timestamp;
47 DataTrackFrame() = default;
48 DataTrackFrame(const DataTrackFrame &) = default;
49 DataTrackFrame(DataTrackFrame &&) noexcept = default;
50 DataTrackFrame &operator=(const DataTrackFrame &) = default;
51 DataTrackFrame &operator=(DataTrackFrame &&) noexcept = default;
52
53 explicit DataTrackFrame(
54 std::vector<std::uint8_t> &&p,
55 std::optional<std::uint64_t> ts = std::nullopt) noexcept
56 : payload(std::move(p)), user_timestamp(ts) {}
57
65 static DataTrackFrame fromOwnedInfo(const proto::DataTrackFrame &owned);
66};
67
68} // namespace livekit
Definition data_track_frame.h:36
std::vector< std::uint8_t > payload
Definition data_track_frame.h:38
static DataTrackFrame fromOwnedInfo(const proto::DataTrackFrame &owned)
This is a private method used by the SDK to create a DataTrackFrame from a proto::DataTrackFrame.
std::optional< std::uint64_t > user_timestamp
Definition data_track_frame.h:46