LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data 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
23#include "livekit/visibility.h"
24
25namespace livekit {
26
27namespace proto {
28class DataTrackFrame;
29} // namespace proto
30
38 std::vector<std::uint8_t> payload;
39
44 std::optional<std::uint64_t> user_timestamp;
45 DataTrackFrame() = default;
46 DataTrackFrame(const DataTrackFrame&) = default;
47 DataTrackFrame(DataTrackFrame&&) noexcept = default;
48 DataTrackFrame& operator=(const DataTrackFrame&) = default;
49 DataTrackFrame& operator=(DataTrackFrame&&) noexcept = default;
50
51 explicit DataTrackFrame(std::vector<std::uint8_t>&& p, std::optional<std::uint64_t> ts = std::nullopt) noexcept
52 : payload(std::move(p)), user_timestamp(ts) {}
53
59 LIVEKIT_API static DataTrackFrame fromOwnedInfo(const proto::DataTrackFrame& owned);
60};
61
62} // namespace livekit
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25
A single frame of data published or received on a data track.
Definition data_track_frame.h:36
std::vector< std::uint8_t > payload
Arbitrary binary payload (the frame contents).
Definition data_track_frame.h:38
static LIVEKIT_API 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
Optional application-defined timestamp.
Definition data_track_frame.h:44