|
LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data SDK for C++
|
Represents a pull-based stream of decoded PCM audio frames coming from a remote (or local) LiveKit track. More...
#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) |
| Blocking read: waits until there is an AudioFrameEvent available in the internal queue, or the stream reaches EOS / is closed. | |
| void | close () |
| Signal that we are no longer interested in audio frames. | |
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. |