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

#include <video_source.h>

Public Member Functions

 VideoSource (int width, int height)
 
 VideoSource (const VideoSource &)=delete
 
VideoSourceoperator= (const VideoSource &)=delete
 
 VideoSource (VideoSource &&) noexcept=default
 
VideoSourceoperator= (VideoSource &&) noexcept=default
 
int width () const noexcept
 Source resolution as declared at construction.
 
int height () const noexcept
 
std::uint64_t ffi_handle_id () const noexcept
 Underlying FFI handle ID (0 if invalid).
 
void captureFrame (const VideoFrame &frame, std::int64_t timestamp_us=0, VideoRotation rotation=VideoRotation::VIDEO_ROTATION_0)
 

Detailed Description

Represents a real-time video source that can accept frames from the application and feed them into the LiveKit core.

Constructor & Destructor Documentation

◆ VideoSource()

livekit::VideoSource::VideoSource ( int  width,
int  height 
)

Create a new native video source with a fixed resolution.

Parameters
widthWidth in pixels.
heightHeight in pixels.

Throws std::runtime_error if the FFI call fails or the response does not contain the expected new_video_source field.

Member Function Documentation

◆ captureFrame()

void livekit::VideoSource::captureFrame ( const VideoFrame frame,
std::int64_t  timestamp_us = 0,
VideoRotation  rotation = VideoRotation::VIDEO_ROTATION_0 
)

Push a VideoFrame into the FFI video source.

Parameters
frameVideo frame to send.
timestamp_usOptional timestamp in microseconds.
rotationVideo rotation enum.
timeout_msControls waiting behavior:

Notes:

  • Fire-and-forget to send a frame to FFI lifetime correctly (e.g., persistent frame pools, GPU buffers, etc.).

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