LiveKit C++ Client SDK v1.4.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
remote_data_track.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 <memory>
21#include <optional>
22#include <string>
23
24#include "livekit/data_track_error.h"
25#include "livekit/data_track_info.h"
26#include "livekit/data_track_stream.h"
27#include "livekit/ffi_handle.h"
28#include "livekit/result.h"
29#include "livekit/visibility.h"
30
31namespace livekit {
32
33namespace proto {
34class OwnedRemoteDataTrack;
35}
36
49 std::optional<std::uint32_t> max_partial_frames{std::nullopt};
50};
51
70public:
71 ~RemoteDataTrack() = default;
72
73 RemoteDataTrack(const RemoteDataTrack&) = delete;
74 RemoteDataTrack& operator=(const RemoteDataTrack&) = delete;
75
77 const DataTrackInfo& info() const noexcept { return info_; }
78
80 const std::string& publisherIdentity() const noexcept { return publisher_identity_; }
81
83 LIVEKIT_API bool isPublished() const;
84
93 LIVEKIT_API void setPipelineOptions(const DataTrackPipelineOptions& options);
94
95#ifdef LIVEKIT_TEST_ACCESS
97 uintptr_t testFfiHandleId() const noexcept { return ffiHandleId(); }
98#endif
99
105 const DataTrackStream::Options& options = {});
106
107private:
108 friend class Room;
109
110 explicit RemoteDataTrack(const proto::OwnedRemoteDataTrack& owned);
111
112 uintptr_t ffiHandleId() const noexcept { return handle_.get(); }
114 FfiHandle handle_;
115
117 DataTrackInfo info_;
118
120 std::string publisher_identity_;
121};
122
123} // namespace livekit
uintptr_t get() const noexcept
Get the raw handle value.
Represents a data track published by a remote participant.
Definition remote_data_track.h:69
const DataTrackInfo & info() const noexcept
Metadata about this data track.
Definition remote_data_track.h:77
const std::string & publisherIdentity() const noexcept
Identity of the remote participant who published this track.
Definition remote_data_track.h:80
LIVEKIT_API Result< std::shared_ptr< DataTrackStream >, SubscribeDataTrackError > subscribe(const DataTrackStream::Options &options={})
Subscribe to this remote data track.
LIVEKIT_API bool isPublished() const
Whether the track is still published by the remote participant.
LIVEKIT_API void setPipelineOptions(const DataTrackPipelineOptions &options)
Configures options for the pipeline handling incoming packets for this track.
Lightweight success-or-error return type for non-exceptional API failures.
Definition result.h:40
Represents a LiveKit room session.
Definition room.h:132
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25
Metadata about a published data track.
Definition data_track_info.h:27
Track-level options that configure how the incoming-frame pipeline reassembles packets for a remote d...
Definition remote_data_track.h:41
std::optional< std::uint32_t > max_partial_frames
Maximum number of partial frames the depacketizer will track concurrently for this track.
Definition remote_data_track.h:49
Options for subscribing to a remote data track stream.
Definition data_track_stream.h:57
Error details returned when subscribing to a remote data track fails.
Definition data_track_error.h:83