|
LiveKit C++ SDK
Real-time audio/video SDK for C++
|
#include <audio_stream.h>
Classes | |
| struct | Options |
| Configuration options for AudioStream creation. More... | |
Public Member Functions | |
| AudioStream (const AudioStream &)=delete | |
| No copy, assignment constructors. | |
| AudioStream & | operator= (const AudioStream &)=delete |
| AudioStream (AudioStream &&) noexcept | |
| AudioStream & | operator= (AudioStream &&) noexcept |
| bool | read (AudioFrameEvent &out_event) |
| void | close () |
Static Public Member Functions | |
| static std::shared_ptr< AudioStream > | fromTrack (const std::shared_ptr< Track > &track, const Options &options) |
| Factory: create an AudioStream bound to a specific Track. | |
| static std::shared_ptr< AudioStream > | fromParticipant (Participant &participant, TrackSource track_source, const Options &options) |
| Factory: create an AudioStream from a Participant + TrackSource. | |
Represents a pull-based stream of decoded PCM audio frames coming from a remote (or local) LiveKit track. Similar to VideoStream, but for audio.
Typical usage:
AudioStream::Options opts; auto stream = AudioStream::fromTrack(remoteAudioTrack, opts);
AudioFrameEvent ev; while (stream->read(ev)) { // ev.frame contains interleaved int16 PCM samples }
stream->close(); // optional, called automatically in destructor
| void livekit::AudioStream::close | ( | ) |
| bool livekit::AudioStream::read | ( | AudioFrameEvent & | out_event | ) |
Blocking read: waits until there is an AudioFrameEvent available in the internal queue, or the stream reaches EOS / is closed.
| out_event | On success, filled with the next audio frame. |