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

Public API for the LiveKit C++ Client SDK. More...

Classes

struct  ActiveSpeakersChangedEvent
 Fired when the list of active speakers changes. More...
 
struct  AttributeEntry
 Key/value pair for participant or room attributes. More...
 
struct  AudioDeviceInfo
 Information about a platform audio device. More...
 
struct  AudioEncodingOptions
 Audio encoding configuration used when publishing a track. More...
 
class  AudioFrame
 Represents a raw PCM audio frame with interleaved int16 samples. More...
 
struct  AudioFrameEvent
 Event containing an audio frame received from an AudioStream. More...
 
struct  AudioPlayoutStats
 Statistics for audio playout performance. More...
 
class  AudioProcessingModule
 WebRTC Audio Processing Module (APM) for real-time audio enhancement. More...
 
class  AudioSource
 Represents a real-time audio source with an internal audio queue. More...
 
struct  AudioSourceStats
 Statistics for a local audio source. More...
 
class  AudioStream
 Represents a pull-based stream of decoded PCM audio frames coming from a remote (or local) LiveKit track. More...
 
struct  BaseStreamInfo
 Base metadata for any stream (text or bytes). More...
 
class  BaseStreamWriter
 Base class for sending data streams. More...
 
struct  ByteStreamInfo
 Metadata for a byte stream. More...
 
struct  ByteStreamOpenedEvent
 Fired when a high-level byte stream reader is opened. More...
 
class  ByteStreamReader
 Reader for incoming byte streams. More...
 
class  ByteStreamWriter
 Writer for outgoing byte streams. More...
 
struct  CandidatePairStats
 Statistics for a selected or candidate ICE pair. More...
 
struct  CertificateStats
 Statistics for a DTLS certificate. More...
 
struct  CodecStats
 Codec statistics for an RTP stream. More...
 
struct  ConnectionQualityChangedEvent
 Fired when a participant's connection quality estimate changes. More...
 
struct  ConnectionStateChangedEvent
 Fired when the room's connection state changes. More...
 
struct  DataChannelBufferedAmountLowThresholdChangedEvent
 Fired when a data channel's buffered amount falls below its low threshold. More...
 
struct  DataChannelStats
 Statistics for a WebRTC data channel. More...
 
struct  DataStreamChunkData
 One chunk of a data stream’s payload. More...
 
struct  DataStreamChunkReceivedEvent
 Fired when a data stream chunk is received. More...
 
struct  DataStreamHeaderData
 Header information for an incoming data stream. More...
 
struct  DataStreamHeaderReceivedEvent
 Fired when a data stream header is received. More...
 
struct  DataStreamTrailerData
 Trailer metadata for a data stream, sent after all chunks. More...
 
struct  DataStreamTrailerReceivedEvent
 Fired when a data stream trailer is received. More...
 
struct  DataTrackFrame
 A single frame of data published or received on a data track. More...
 
struct  DataTrackInfo
 Metadata about a published data track. More...
 
struct  DataTrackPublishedEvent
 Fired when a participant publishes a data track. More...
 
class  DataTrackStream
 Represents a pull-based stream of frames from a remote data track. More...
 
struct  DataTrackUnpublishedEvent
 Fired when a remote participant unpublishes a data track. More...
 
struct  DisconnectedEvent
 Fired when the room is disconnected. More...
 
class  E2EEManager
 E2EE manager for a connected room. More...
 
struct  E2EEOptions
 End-to-end encryption (E2EE) configuration for a room. More...
 
struct  E2eeStateChangedEvent
 Fired when a participant's E2EE state changes. More...
 
class  FfiHandle
 RAII wrapper for an FFI handle (uintptr_t) coming from Rust. More...
 
struct  IceCandidateStats
 Statistics for a local or remote ICE candidate. More...
 
struct  IceServer
 Represents a single ICE server configuration. More...
 
struct  InboundRtpStreamStats
 Statistics for inbound RTP media. More...
 
struct  KeyProviderOptions
 Options for configuring the key provider used by E2EE. More...
 
class  LocalAudioTrack
 Represents a user-provided audio track sourced from the local device. More...
 
class  LocalDataTrack
 Represents a locally published data track. More...
 
struct  LocalDataTrackTryPushError
 Error details returned when pushing a frame to a local data track fails. More...
 
class  LocalParticipant
 Represents the local participant in a room. More...
 
class  LocalTrackPublication
 A track published by a local participant. More...
 
struct  LocalTrackPublishedEvent
 Fired when a local track is successfully published. More...
 
struct  LocalTrackSubscribedEvent
 Fired when a local track gets its first subscriber. More...
 
struct  LocalTrackUnpublishedEvent
 Fired when a local track is unpublished. More...
 
class  LocalVideoTrack
 Represents a user-provided video track sourced from the local device. More...
 
struct  MediaSourceStats
 Common statistics for a local media source. More...
 
struct  OutboundRtpStreamStats
 Statistics for outbound RTP media. More...
 
struct  PacketTrailerFeatures
 Optional RTP packet-trailer features for published video tracks. More...
 
class  Participant
 Base class for local and remote room participants. More...
 
struct  ParticipantAttributesChangedEvent
 Fired when a participant's attributes change. More...
 
struct  ParticipantConnectedEvent
 Fired when a remote participant joins the room. More...
 
struct  ParticipantDisconnectedEvent
 Fired when a remote participant leaves the room. More...
 
struct  ParticipantEncryptionStatusChangedEvent
 Fired when a participant's encryption status changes. More...
 
struct  ParticipantMetadataChangedEvent
 Fired when a participant's metadata is updated. More...
 
struct  ParticipantNameChangedEvent
 Fired when a participant's name changes. More...
 
struct  ParticipantsUpdatedEvent
 Fired when a batch of participants has been updated. More...
 
struct  ParticipantTrackPermission
 Per-participant track subscription permission configuration. More...
 
struct  PeerConnectionStats
 Statistics for a peer connection. More...
 
class  PlatformAudio
 Platform audio device manager backed by WebRTC's Audio Device Module. More...
 
class  PlatformAudioError
 Error raised when platform audio setup or device operations fail. More...
 
struct  PlatformAudioOptions
 Audio processing options for platform microphone capture. More...
 
class  PlatformAudioSource
 Audio source backed by WebRTC's platform Audio Device Module. More...
 
struct  PublishDataTrackError
 Error details returned when publishing a local data track fails. More...
 
struct  ReceivedRtpStreamStats
 Statistics for received RTP streams. More...
 
struct  ReconnectedEvent
 Fired after successfully reconnecting. More...
 
struct  ReconnectingEvent
 Fired just before attempting to reconnect. More...
 
class  RemoteAudioTrack
 Represents an audio track published by a remote participant and subscribed to by the local participant. More...
 
class  RemoteDataTrack
 Represents a data track published by a remote participant. More...
 
struct  RemoteInboundRtpStreamStats
 Statistics reported by a remote receiver for a local outbound RTP stream. More...
 
struct  RemoteOutboundRtpStreamStats
 Statistics reported by a remote sender for a local inbound RTP stream. More...
 
class  RemoteParticipant
 Represents a remote participant in a LiveKit room. More...
 
class  RemoteTrackPublication
 A track published by a remote participant. More...
 
class  RemoteVideoTrack
 Represents an video track published by a remote participant and subscribed to by the local participant. More...
 
class  Result
 Lightweight success-or-error return type for non-exceptional API failures. More...
 
class  Result< void, E >
 void specialization for operations that only report success or failure. More...
 
class  Room
 Represents a LiveKit room session. More...
 
class  RoomDelegate
 Interface for receiving room-level events. More...
 
struct  RoomEosEvent
 Fired when the room has reached end-of-stream (no more events). More...
 
struct  RoomInfoData
 Snapshot of core room information. More...
 
struct  RoomMetadataChangedEvent
 Fired when room metadata is updated. More...
 
struct  RoomMovedEvent
 Fired when the participant has been moved to another room. More...
 
struct  RoomOptions
 Top-level room connection options. More...
 
struct  RoomSidChangedEvent
 Fired when the room SID changes (e.g., after migration). More...
 
struct  RoomUpdatedEvent
 Fired when the room's info is updated. More...
 
class  RpcError
 Specialized error type for RPC methods. More...
 
struct  RpcInvocationData
 Data passed to a registered RPC method handler. More...
 
struct  RtcCandidatePairStats
 Typed RTC stats wrapper for ICE candidate pair statistics. More...
 
struct  RtcCertificateStats
 Typed RTC stats wrapper for certificate statistics. More...
 
struct  RtcCodecStats
 Typed RTC stats wrapper for codec statistics. More...
 
struct  RtcConfig
 WebRTC configuration (ICE, transport, etc.). More...
 
struct  RtcDataChannelStats
 Typed RTC stats wrapper for data channel statistics. More...
 
struct  RtcInboundRtpStats
 Typed RTC stats wrapper for inbound RTP statistics. More...
 
struct  RtcLocalCandidateStats
 Typed RTC stats wrapper for local ICE candidate statistics. More...
 
struct  RtcMediaPlayoutStats
 Typed RTC stats wrapper for audio playout statistics. More...
 
struct  RtcMediaSourceStats
 Typed RTC stats wrapper for media source statistics. More...
 
struct  RtcOutboundRtpStats
 Typed RTC stats wrapper for outbound RTP statistics. More...
 
struct  RtcPeerConnectionStats
 Typed RTC stats wrapper for peer connection statistics. More...
 
struct  RtcRemoteCandidateStats
 Typed RTC stats wrapper for remote ICE candidate statistics. More...
 
struct  RtcRemoteInboundRtpStats
 Typed RTC stats wrapper for remote inbound RTP statistics. More...
 
struct  RtcRemoteOutboundRtpStats
 Typed RTC stats wrapper for remote outbound RTP statistics. More...
 
struct  RtcStats
 Variant wrapper for typed RTC stats records. More...
 
struct  RtcStatsData
 Base data shared by RTC stats records. More...
 
struct  RtcStreamStats
 Typed RTC stats wrapper for media stream statistics. More...
 
struct  RtcTransportStats
 Typed RTC stats wrapper for transport statistics. More...
 
struct  RtpStreamStats
 Base statistics for an RTP stream. More...
 
struct  SentRtpStreamStats
 Statistics for sent RTP streams. More...
 
struct  SessionStats
 Aggregated WebRTC stats for a connected room session. More...
 
struct  SipDtmfData
 SIP (Session Initiation Protocol) DTMF payload carried via data packets. More...
 
struct  SipDtmfReceivedEvent
 Fired when a SIP DTMF packet is received. More...
 
struct  StreamStats
 Statistics for a media stream. More...
 
struct  SubscribeDataTrackError
 Error details returned when subscribing to a remote data track fails. More...
 
class  SubscriptionThreadDispatcher
 Owns subscription callback registration and per-subscription reader threads. More...
 
struct  TextStreamInfo
 Metadata for a text stream. More...
 
struct  TextStreamOpenedEvent
 Fired when a high-level text stream reader is opened. More...
 
class  TextStreamReader
 Reader for incoming text streams. More...
 
class  TextStreamWriter
 Writer for outgoing text streams. More...
 
class  Track
 Base class for local and remote media tracks. More...
 
struct  TrackMutedEvent
 Fired when a track is muted. More...
 
class  TrackPublication
 Base class for a track that has been published to a room. More...
 
struct  TrackPublishedEvent
 Fired when a remote participant publishes a track. More...
 
struct  TrackPublishOptions
 Options for publishing a track to the room. More...
 
struct  TrackSubscribedEvent
 Fired when a remote track is successfully subscribed. More...
 
struct  TrackSubscriptionFailedEvent
 Fired when subscribing to a remote track fails. More...
 
struct  TrackUnmutedEvent
 Fired when a track is unmuted. More...
 
struct  TrackUnpublishedEvent
 Fired when a remote participant unpublishes a track. More...
 
struct  TrackUnsubscribedEvent
 Fired when a remote track is unsubscribed. More...
 
struct  TransportStats
 Statistics for a WebRTC transport. More...
 
struct  UserDataPacketEvent
 Fired when a user data packet (non-SIP) is received. More...
 
struct  UserPacketData
 Application-level user data carried in a data packet. More...
 
struct  VideoCaptureOptions
 Capture options for a single outbound video frame. More...
 
struct  VideoEncodingOptions
 Video encoding configuration used when publishing a track. More...
 
class  VideoFrame
 Public SDK representation of a video frame. More...
 
struct  VideoFrameEvent
 A single video frame event delivered by VideoStream::read(). More...
 
struct  VideoFrameMetadata
 Optional packet-trailer metadata carried alongside a video frame. More...
 
struct  VideoPlaneInfo
 Plane layout metadata for a VideoFrame buffer. More...
 
class  VideoSource
 Represents a real-time video source that can accept frames from the application and feed them into the LiveKit core. More...
 
struct  VideoSourceStats
 Statistics for a local video source. More...
 
class  VideoStream
 Represents a pull-based stream of decoded video frames coming from a remote (or local) LiveKit track. More...
 

Typedefs

using TextStreamHandler = std::function< void(std::shared_ptr< TextStreamReader >, const std::string &participant_identity)>
 Callback invoked when a new incoming text stream is opened.
 
using ByteStreamHandler = std::function< void(std::shared_ptr< ByteStreamReader >, const std::string &participant_identity)>
 Callback invoked when a new incoming byte stream is opened.
 
using LogCallback = std::function< void(LogLevel level, const std::string &logger_name, const std::string &message)>
 Signature for a user-supplied log callback.
 
using RtcStatsVariant = std::variant< RtcCodecStats, RtcInboundRtpStats, RtcOutboundRtpStats, RtcRemoteInboundRtpStats, RtcRemoteOutboundRtpStats, RtcMediaSourceStats, RtcMediaPlayoutStats, RtcPeerConnectionStats, RtcDataChannelStats, RtcTransportStats, RtcCandidatePairStats, RtcLocalCandidateStats, RtcRemoteCandidateStats, RtcCertificateStats, RtcStreamStats >
 
using AudioFrameCallback = std::function< void(const AudioFrame &)>
 Callback type for incoming audio frames.
 
using VideoFrameCallback = std::function< void(const VideoFrame &frame, std::int64_t timestamp_us)>
 Callback type for incoming video frames.
 
using VideoFrameEventCallback = std::function< void(const VideoFrameEvent &)>
 Callback type for incoming video frame events.
 
using DataFrameCallback = std::function< void(const std::vector< std::uint8_t > &payload, std::optional< std::uint64_t > user_timestamp)>
 Callback type for incoming data track frames.
 
using DataFrameCallbackId = std::uint64_t
 Opaque identifier returned by addOnDataFrameCallback, used to remove an individual subscription via removeOnDataFrameCallback.
 

Enumerations

enum class  PublishDataTrackErrorCode : std::uint32_t {
  UNKNOWN = 0 , INVALID_HANDLE = 1 , DUPLICATE_NAME = 2 , TIMEOUT = 3 ,
  DISCONNECTED = 4 , NOT_ALLOWED = 5 , INVALID_NAME = 6 , LIMIT_REACHED = 7 ,
  PROTOCOL_ERROR = 8 , INTERNAL = 9
}
 Error code returned when publishing a local data track fails.
 
enum class  LocalDataTrackTryPushErrorCode : std::uint32_t {
  UNKNOWN = 0 , INVALID_HANDLE = 1 , TRACK_UNPUBLISHED = 2 , QUEUE_FULL = 3 ,
  INTERNAL = 4
}
 Error code returned when pushing a frame to a local data track fails.
 
enum class  SubscribeDataTrackErrorCode : std::uint32_t {
  UNKNOWN = 0 , INVALID_HANDLE = 1 , UNPUBLISHED = 2 , TIMEOUT = 3 ,
  DISCONNECTED = 4 , PROTOCOL_ERROR = 5 , INTERNAL = 6
}
 Error code returned when subscribing to a remote data track fails.
 
enum class  EncryptionType { NONE = 0 , GCM = 1 , CUSTOM = 2 }
 Encryption algorithm type used by the underlying stack. More...
 
enum class  KeyDerivationFunction { PBKDF2 = 0 , HKDF = 1 }
 Key derivation algorithm used by the key provider.
 
enum class  LogLevel {
  Trace = 0 , Debug = 1 , Info = 2 , Warn = 3 ,
  Error = 4 , Critical = 5 , Off = 6
}
 Severity levels for SDK log messages.
 
enum class  ParticipantKind {
  Standard = 0 , Ingress , Egress , Sip ,
  Agent
}
 Identifies the type of participant connected to a room.
 
enum class  ConnectionQuality { Poor = 0 , Good , Excellent , Lost }
 Overall quality of a participant's connection.
 
enum class  ConnectionState { Disconnected = 0 , Connected , Reconnecting }
 Current connection state of the room.
 
enum class  DataPacketKind { Lossy , Reliable }
 Type of data packet delivery semantics. More...
 
enum class  EncryptionState {
  New = 0 , Ok , EncryptionFailed , DecryptionFailed ,
  MissingKey , KeyRatcheted , InternalError
}
 End-to-end encryption state for a participant. More...
 
enum class  DisconnectReason {
  Unknown = 0 , ClientInitiated , DuplicateIdentity , ServerShutdown ,
  ParticipantRemoved , RoomDeleted , StateMismatch , JoinFailure ,
  Migration , SignalClose , RoomClosed , UserUnavailable ,
  UserRejected , SipTrunkFailure , ConnectionTimeout , MediaFailure
}
 Reason why a participant or room was disconnected. More...
 
enum class  DataChannelState {
  Connecting , Open , Closing , Closed ,
  Unknown
}
 State of a WebRTC data channel.
 
enum class  QualityLimitationReason { None , Cpu , Bandwidth , Other }
 Reason outbound media quality is currently limited.
 
enum class  IceRole { Unknown , Controlling , Controlled }
 ICE role used by a transport.
 
enum class  DtlsTransportState {
  New , Connecting , Connected , Closed ,
  Failed , Unknown
}
 DTLS transport state.
 
enum class  IceTransportState {
  New , Checking , Connected , Completed ,
  Disconnected , Failed , Closed , Unknown
}
 ICE transport state.
 
enum class  DtlsRole { Client , Server , Unknown }
 DTLS role used by a transport.
 
enum class  IceCandidatePairState {
  Frozen , Waiting , InProgress , Failed ,
  Succeeded , Unknown
}
 State of an ICE candidate pair.
 
enum class  IceCandidateType {
  Host , Srflx , Prflx , Relay ,
  Unknown
}
 Type of ICE candidate.
 
enum class  IceServerTransportProtocol { Udp , Tcp , Tls , Unknown }
 Transport protocol used by an ICE server.
 
enum class  IceTcpCandidateType { Active , Passive , So , Unknown }
 TCP candidate type for an ICE candidate.
 
enum class  TrackKind { KIND_UNKNOWN = 0 , KIND_AUDIO = 1 , KIND_VIDEO = 2 }
 Media kind for an audio or video track.
 
enum class  TrackSource {
  SOURCE_UNKNOWN = 0 , SOURCE_CAMERA = 1 , SOURCE_MICROPHONE = 2 , SOURCE_SCREENSHARE = 3 ,
  SOURCE_SCREENSHARE_AUDIO = 4
}
 Source category for a published track.
 
enum class  StreamState { STATE_UNKNOWN = 0 , STATE_ACTIVE = 1 , STATE_PAUSED = 2 }
 Stream state reported for a subscribed track.
 
enum class  AudioTrackFeature {
  TF_STEREO = 0 , TF_NO_DTX = 1 , TF_AUTO_GAIN_CONTROL = 2 , TF_ECHO_CANCELLATION = 3 ,
  TF_NOISE_SUPPRESSION = 4 , TF_ENHANCED_NOISE_CANCELLATION = 5 , TF_PRECONNECT_BUFFER = 6
}
 Optional audio processing or encoding feature advertised for a track.
 
enum class  VideoBufferType {
  RGBA = 0 , ABGR , ARGB , BGRA ,
  RGB24 , I420 , I420A , I422 ,
  I444 , I010 , NV12
}
 Mirror of WebRTC video buffer type.
 
enum class  VideoRotation { VIDEO_ROTATION_0 = 0 , VIDEO_ROTATION_90 = 90 , VIDEO_ROTATION_180 = 180 , VIDEO_ROTATION_270 = 270 }
 Rotation of a video frame. More...
 

Functions

LIVEKIT_API bool initialize (const LogLevel &level=LogLevel::Info)
 Initialize the LiveKit SDK.
 
LIVEKIT_API void shutdown ()
 Shut down the LiveKit SDK.
 
LIVEKIT_API void setLogLevel (LogLevel level)
 Set the minimum log level for the SDK logger.
 
LIVEKIT_API LogLevel getLogLevel ()
 Return the current minimum log level.
 
LIVEKIT_API void setLogCallback (LogCallback callback)
 Install a custom log callback, replacing the default stderr sink.
 
LIVEKIT_API std::ostream & operator<< (std::ostream &os, const RemoteParticipant &participant)
 Convenience for logging / streaming.
 
LIVEKIT_API RtcStatsData fromProto (const proto::RtcStatsData &)
 
LIVEKIT_API CodecStats fromProto (const proto::CodecStats &)
 
LIVEKIT_API RtpStreamStats fromProto (const proto::RtpStreamStats &)
 
LIVEKIT_API ReceivedRtpStreamStats fromProto (const proto::ReceivedRtpStreamStats &)
 
LIVEKIT_API InboundRtpStreamStats fromProto (const proto::InboundRtpStreamStats &)
 
LIVEKIT_API SentRtpStreamStats fromProto (const proto::SentRtpStreamStats &)
 
LIVEKIT_API OutboundRtpStreamStats fromProto (const proto::OutboundRtpStreamStats &)
 
LIVEKIT_API RemoteInboundRtpStreamStats fromProto (const proto::RemoteInboundRtpStreamStats &)
 
LIVEKIT_API RemoteOutboundRtpStreamStats fromProto (const proto::RemoteOutboundRtpStreamStats &)
 
LIVEKIT_API MediaSourceStats fromProto (const proto::MediaSourceStats &)
 
LIVEKIT_API AudioSourceStats fromProto (const proto::AudioSourceStats &)
 
LIVEKIT_API VideoSourceStats fromProto (const proto::VideoSourceStats &)
 
LIVEKIT_API AudioPlayoutStats fromProto (const proto::AudioPlayoutStats &)
 
LIVEKIT_API PeerConnectionStats fromProto (const proto::PeerConnectionStats &)
 
LIVEKIT_API DataChannelStats fromProto (const proto::DataChannelStats &)
 
LIVEKIT_API TransportStats fromProto (const proto::TransportStats &)
 
LIVEKIT_API CandidatePairStats fromProto (const proto::CandidatePairStats &)
 
LIVEKIT_API IceCandidateStats fromProto (const proto::IceCandidateStats &)
 
LIVEKIT_API CertificateStats fromProto (const proto::CertificateStats &)
 
LIVEKIT_API StreamStats fromProto (const proto::StreamStats &)
 
LIVEKIT_API RtcStats fromProto (const proto::RtcStats &)
 
LIVEKIT_API std::vector< RtcStatsfromProto (const std::vector< proto::RtcStats > &)
 
LIVEKIT_API bool startTracing (const std::string &trace_file_path, const std::vector< std::string > &categories={})
 Start tracing and write events to a file.
 
LIVEKIT_API void stopTracing ()
 Stop tracing and flush remaining events to file.
 
LIVEKIT_API bool isTracingEnabled ()
 Check if tracing is currently active.
 

Variables

constexpr std::size_t kStreamChunkSize = 15'000
 Chunk size for data streams (matches Python STREAM_CHUNK_SIZE).
 
constexpr const char * kDefaultRatchetSalt = "LKFrameEncryptionKey"
 Defaults (match Rust KeyProviderOptions::default()).
 
constexpr int kDefaultRatchetWindowSize = 16
 
constexpr int kDefaultFailureTolerance = -1
 
constexpr int kDefaultKeyRingSize = 16
 
constexpr KeyDerivationFunction kDefaultKeyDerivationFunction = KeyDerivationFunction::PBKDF2
 

Detailed Description

Public API for the LiveKit C++ Client SDK.

Typedef Documentation

◆ AudioFrameCallback

using livekit::AudioFrameCallback = typedef std::function<void(const AudioFrame&)>

Callback type for incoming audio frames.

Invoked on a dedicated reader thread per (participant, track_name) pair.

◆ ByteStreamHandler

using livekit::ByteStreamHandler = typedef std::function<void(std::shared_ptr<ByteStreamReader>, const std::string& participant_identity)>

Callback invoked when a new incoming byte stream is opened.

The ByteStreamReader is provided as a shared_ptr to ensure it remains alive for the duration of asynchronous reads (for example, file writes or background processing).

◆ DataFrameCallback

using livekit::DataFrameCallback = typedef std::function<void(const std::vector<std::uint8_t>& payload, std::optional<std::uint64_t> user_timestamp)>

Callback type for incoming data track frames.

Invoked on a dedicated reader thread per subscription.

Parameters
payloadRaw binary data received.
user_timestampOptional application-defined timestamp from sender.

◆ LogCallback

using livekit::LogCallback = typedef std::function<void(LogLevel level, const std::string& logger_name, const std::string& message)>

Signature for a user-supplied log callback.

Parameters
levelSeverity of the message.
logger_nameName of the originating logger (e.g. "livekit").
messageFormatted log message (no trailing newline).

The callback is invoked sequentially (never concurrently) from the thread that generated the log message. Implementations must not block for extended periods.

◆ TextStreamHandler

using livekit::TextStreamHandler = typedef std::function<void(std::shared_ptr<TextStreamReader>, const std::string& participant_identity)>

Callback invoked when a new incoming text stream is opened.

The TextStreamReader is provided as a shared_ptr to ensure it remains alive for the duration of asynchronous reads (for example, when the user spawns a background thread to consume the stream).

◆ VideoFrameCallback

using livekit::VideoFrameCallback = typedef std::function<void(const VideoFrame& frame, std::int64_t timestamp_us)>

Callback type for incoming video frames.

Invoked on a dedicated reader thread per (participant, track_name) pair.

◆ VideoFrameEventCallback

using livekit::VideoFrameEventCallback = typedef std::function<void(const VideoFrameEvent&)>

Callback type for incoming video frame events.

Invoked on a dedicated reader thread per (participant, track_name) pair.

Enumeration Type Documentation

◆ DataPacketKind

enum class livekit::DataPacketKind
strong

Type of data packet delivery semantics.

  • Lossy: unordered, unreliable (e.g. for real-time updates).
  • Reliable: ordered, reliable (e.g. for critical messages).

◆ DisconnectReason

enum class livekit::DisconnectReason
strong

Reason why a participant or room was disconnected.

These values mirror the server-side DisconnectReason enum.

Enumerator
SipTrunkFailure 

SIP (telephony) trunk connection failed.

◆ EncryptionState

enum class livekit::EncryptionState
strong

End-to-end encryption state for a participant.

These values mirror the proto::EncryptionState enum.

◆ EncryptionType

enum class livekit::EncryptionType
strong

Encryption algorithm type used by the underlying stack.

Keep this aligned with your proto enum values.

◆ VideoRotation

enum class livekit::VideoRotation
strong

Rotation of a video frame.

Mirrors proto_video.VideoRotation but kept as a public SDK enum.

Function Documentation

◆ initialize()

LIVEKIT_API bool livekit::initialize ( const LogLevel level = LogLevel::Info)

Initialize the LiveKit SDK.

This must be the first LiveKit API called in the process. It configures global SDK state, including log routing.

Parameters
levelMinimum log level for SDK messages (default: Info). Use setLogLevel() to change at runtime.
Returns
true if initialization happened on this call, false if it was already initialized.

◆ isTracingEnabled()

LIVEKIT_API bool livekit::isTracingEnabled ( )

Check if tracing is currently active.

Returns
true if tracing is running

◆ setLogCallback()

LIVEKIT_API void livekit::setLogCallback ( LogCallback  callback)

Install a custom log callback, replacing the default stderr sink.

Pass nullptr / empty function to restore the default stderr sink. Thread-safe; may be called at any time after initialize().

◆ setLogLevel()

LIVEKIT_API void livekit::setLogLevel ( LogLevel  level)

Set the minimum log level for the SDK logger.

Messages below this level are discarded before reaching any sink or callback. Thread-safe; may be called at any time after initialize().

◆ shutdown()

LIVEKIT_API void livekit::shutdown ( )

Shut down the LiveKit SDK.

After shutdown, you may call initialize() again.

◆ startTracing()

LIVEKIT_API bool livekit::startTracing ( const std::string &  trace_file_path,
const std::vector< std::string > &  categories = {} 
)

Start tracing and write events to a file.

Events are written to the file asynchronously by a background thread. The file is written in Chrome trace format (JSON), viewable in:

Parameters
trace_file_pathPath to the output trace file (e.g., "trace.json")
categoriesCategories to enable (empty = all categories). Supports wildcards: "livekit.*" matches all livekit categories.
Returns
true if tracing was started, false if already running or file error

◆ stopTracing()

LIVEKIT_API void livekit::stopTracing ( )

Stop tracing and flush remaining events to file.

This blocks until all pending events are written and the file is closed. After stopping, the trace file is complete and ready for analysis.

Variable Documentation

◆ kStreamChunkSize

constexpr std::size_t livekit::kStreamChunkSize = 15'000
constexpr

Chunk size for data streams (matches Python STREAM_CHUNK_SIZE).

Chosen to balance throughput and latency, and to work well with WebRTC data channels.