LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
livekit::DataTrackStream Class Reference

#include <data_track_stream.h>

Classes

struct  Options
 

Public Member Functions

 DataTrackStream (const DataTrackStream &)=delete
 
DataTrackStreamoperator= (const DataTrackStream &)=delete
 
 DataTrackStream (DataTrackStream &&) noexcept=delete
 
DataTrackStreamoperator= (DataTrackStream &&) noexcept=delete
 
bool read (DataTrackFrame &out)
 
void close ()
 

Friends

class RemoteDataTrack
 

Detailed Description

Represents a pull-based stream of frames from a remote data track.

Provides a blocking read() interface similar to AudioStream / VideoStream. Frames are delivered via FfiEvent callbacks and stored internally.

Destroying the stream automatically unsubscribes from the remote track by releasing the underlying FFI handle.

Typical usage:

auto sub_result = remoteDataTrack->subscribe(); if (sub_result) { auto sub = sub_result.value(); DataTrackFrame frame; while (sub->read(frame)) { // process frame.payload } }

Member Function Documentation

◆ close()

void livekit::DataTrackStream::close ( )

End the stream early.

Releases the FFI handle (which unsubscribes from the remote track), unregisters the event listener, and wakes any blocking read().

◆ read()

bool livekit::DataTrackStream::read ( DataTrackFrame out)

Blocking read: waits until a DataTrackFrame is available, or the stream reaches EOS / is closed.

Parameters
outOn success, filled with the next data frame.
Returns
true if a frame was delivered; false if the stream ended.

The documentation for this class was generated from the following file: