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

Writer for outgoing byte streams. More...

#include <data_stream.h>

Inheritance diagram for livekit::ByteStreamWriter:
Collaboration diagram for livekit::ByteStreamWriter:

Public Member Functions

 ByteStreamWriter (LocalParticipant &local_participant, const std::string &name, const std::string &topic="", const std::map< std::string, std::string > &attributes={}, const std::string &stream_id="", std::optional< std::size_t > total_size=std::nullopt, const std::string &mime_type="application/octet-stream", const std::vector< std::string > &destination_identities={}, const std::string &sender_identity="")
 
void write (const std::vector< std::uint8_t > &data)
 
const ByteStreamInfoinfo () const noexcept
 Metadata associated with this stream.
 
- Public Member Functions inherited from livekit::BaseStreamWriter
const std::string & streamId () const noexcept
 Stream id assigned to this writer.
 
const std::string & topic () const noexcept
 Topic of this stream.
 
const std::string & mimeType () const noexcept
 MIME type for this stream.
 
std::int64_t timestampMs () const noexcept
 Timestamp (ms) when the stream was created.
 
bool isClosed () const noexcept
 Whether the stream has been closed.
 
void close (const std::string &reason="", const std::map< std::string, std::string > &attributes={})
 

Additional Inherited Members

- Protected Types inherited from livekit::BaseStreamWriter
enum class  StreamKind { kUnknown , kText , kByte }
 
- Protected Member Functions inherited from livekit::BaseStreamWriter
 BaseStreamWriter (LocalParticipant &local_participant, const std::string &topic="", const std::map< std::string, std::string > &attributes={}, const std::string &stream_id="", std::optional< std::size_t > total_size=std::nullopt, const std::string &mime_type="", const std::vector< std::string > &destination_identities={}, const std::string &sender_identity="")
 
void ensureHeaderSent ()
 
void sendChunk (const std::vector< std::uint8_t > &content)
 
void sendTrailer (const std::string &reason, const std::map< std::string, std::string > &attributes)
 
- Protected Attributes inherited from livekit::BaseStreamWriter
LocalParticipantlocal_participant_
 
std::string stream_id_
 
std::string mime_type_
 
std::string topic_
 
std::int64_t timestamp_ms_ = 0
 
std::optional< std::size_t > total_size_
 
std::map< std::string, std::string > attributes_
 
std::vector< std::string > destination_identities_
 
std::string sender_identity_
 
bool closed_ = false
 
bool header_sent_ = false
 
std::uint64_t next_chunk_index_ = 0
 
StreamKind kind_ = StreamKind::kUnknown
 
std::string reply_to_id_
 
std::string byte_name_
 

Detailed Description

Writer for outgoing byte streams.

Member Function Documentation

◆ write()

void livekit::ByteStreamWriter::write ( const std::vector< std::uint8_t > &  data)

Write binary data to the stream. Data will be chunked into kStreamChunkSize-sized chunks. Throws on error or if the stream is closed.


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