LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
livekit::VideoStream Class Reference

Represents a pull-based stream of decoded video frames coming from a remote (or local) LiveKit track. More...

#include <video_stream.h>

Classes

struct  Options
 Options for creating a decoded video frame stream. More...
 

Public Member Functions

 VideoStream (const VideoStream &)=delete
 
VideoStreamoperator= (const VideoStream &)=delete
 
 VideoStream (VideoStream &&) noexcept
 
VideoStreamoperator= (VideoStream &&) noexcept
 
bool read (VideoFrameEvent &out)
 Blocking read: waits until a VideoFrameEvent is available in the internal queue, or the stream reaches EOS / is closed.
 
void close ()
 Signal that we are no longer interested in video frames.
 

Static Public Member Functions

static std::shared_ptr< VideoStreamfromTrack (const std::shared_ptr< Track > &track, const Options &options)
 Factory: create a VideoStream bound to a specific Track.
 
static std::shared_ptr< VideoStreamfromParticipant (Participant &participant, TrackSource track_source, const Options &options)
 Factory: create a VideoStream from a Participant + TrackSource.
 

Detailed Description

Represents a pull-based stream of decoded video frames coming from a remote (or local) LiveKit track.

Similar to AudioStream, but for video.

Typical usage:

VideoStream::Options opts; auto stream = VideoStream::fromTrack(remoteVideoTrack, opts);

VideoFrameEvent ev; while (stream->read(ev)) { // ev.frame contains the decoded video buffer }

stream->close(); // optional, called automatically in destructor

Member Function Documentation

◆ close()

void livekit::VideoStream::close ( )

Signal that we are no longer interested in video frames.

This disposes the underlying FFI video stream, unregisters the listener from FfiClient, marks the stream as closed, and wakes any blocking read(). After calling close(), further calls to read() will return false.

◆ read()

bool livekit::VideoStream::read ( VideoFrameEvent out)

Blocking read: waits until a VideoFrameEvent is available in the internal queue, or the stream reaches EOS / is closed.

Parameters
outOn success, filled with the next video frame event.
Returns
true if a frame was delivered; false if the stream ended (end-of-stream or close()) and no more data is available.

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