LiveKit C++ Client SDK v1.12.2
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
livekit::EncodedVideoSource Class Referencefinal

Video source for publishing pre-encoded access units without re-encoding. More...

#include <encoded_video_source.h>

Inheritance diagram for livekit::EncodedVideoSource:
Collaboration diagram for livekit::EncodedVideoSource:

Classes

struct  Feedback
 Pending feedback from the pre-encoded passthrough encoder. More...
 
struct  Frame
 One complete pre-encoded video access unit. More...
 
struct  RateControl
 Latest encoder rate-control target requested by the publishing pipeline. More...
 

Public Member Functions

 EncodedVideoSource (VideoCodec codec, int width, int height)
 Create a pre-encoded source for one codec and initial resolution.
 
VideoCodec codec () const noexcept
 Codec carried by every frame submitted to this source.
 
bool captureFrame (const Frame &frame) const
 Submit one complete encoded access unit.
 
Feedback takeFeedback () const
 Consume pending keyframe and rate-control feedback.
 
- Public Member Functions inherited from livekit::VideoSource
 VideoSource (int width, int height)
 Create a new native video source with a fixed resolution.
 
 VideoSource (const VideoSource &)=delete
 
VideoSource & operator= (const VideoSource &)=delete
 
 VideoSource (VideoSource &&) noexcept=default
 
VideoSource & operator= (VideoSource &&) noexcept=default
 
int width () const noexcept
 Source resolution as declared at construction.
 
int height () const noexcept
 
std::uint64_t ffiHandleId () const noexcept
 Underlying FFI handle ID (0 if invalid).
 
void captureFrame (const VideoFrame &frame, const VideoCaptureOptions &options)
 Push a VideoFrame into the FFI video source.
 
void captureFrame (const VideoFrame &frame, std::int64_t timestamp_us=0, VideoRotation rotation=VideoRotation::VIDEO_ROTATION_0)
 Backward-compatible convenience overload for timestamp + rotation only.
 

Detailed Description

Video source for publishing pre-encoded access units without re-encoding.

Capture calls are synchronous and copy the payload before returning. This type is not safe for concurrent capture calls. Feedback polling can run on another application thread.

Constructor & Destructor Documentation

◆ EncodedVideoSource()

livekit::EncodedVideoSource::EncodedVideoSource ( VideoCodec  codec,
int  width,
int  height 
)

Create a pre-encoded source for one codec and initial resolution.

Parameters
codecCodec carried by every frame submitted to this source. This must match TrackPublishOptions::video_codec.
widthInitial source width in pixels. Must be in [1, 65535].
heightInitial source height in pixels. Must be in [1, 65535].
Exceptions
std::invalid_argumentif either dimension is outside [1, 65535].
std::runtime_errorif source creation fails.

Member Function Documentation

◆ captureFrame()

bool livekit::EncodedVideoSource::captureFrame ( const Frame &  frame) const

Submit one complete encoded access unit.

Parameters
frameEncoded frame. Its payload is copied during this call.
Returns
True if the frame was accepted.
Exceptions
std::invalid_argumentif the frame is empty, too large, has only one zero dimension, or has a dimension above 65535.
std::runtime_errorif the FFI request fails.

◆ takeFeedback()

Feedback livekit::EncodedVideoSource::takeFeedback ( ) const

Consume pending keyframe and rate-control feedback.

Returns
Feedback accumulated since the previous call. Rate-control updates use latest-value-wins semantics.
Exceptions
std::runtime_errorif the FFI request fails.

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