Open
Conversation
The data stream manager module handles incoming streams only. Rename it to data_stream_reader in preparation for adding a symmetric data_stream_writer module for outgoing streams.
Add generate_uuid() to utils for generating random UUID v4 strings using esp_random(). This will be used for data stream identifiers.
Add data_stream_writer as the symmetric counterpart to data_stream_reader for outgoing data streams. The writer manages a fixed array of stream slots and handles protobuf packet construction, auto-chunking (15KB), and sending via a callback.
Add livekit_room_data_stream_open/write/close for sending outgoing data streams. The writer is created during room initialization and wired through the existing reliable data channel send path. The writer strdup's the topic on open and frees it on close/destroy, matching the reader's ownership pattern.
Replace reuse of livekit_data_stream_header_t with a purpose-built livekit_data_stream_options_t that only contains the fields the caller controls (topic, is_text, total_length, has_total_length). This follows the livekit_data_publish_options_t pattern and avoids the "which fields do I fill in?" ambiguity.
Replace CONFIG_LK_MAX_DATA_STREAMS with separate CONFIG_LK_MAX_DATA_STREAM_READERS and CONFIG_LK_MAX_DATA_STREAM_WRITERS so incoming and outgoing stream limits can be tuned independently.
Use PRIx32 instead of %x to avoid -Werror=format on Xtensa where uint32_t is long unsigned int.
Text streams now avoid splitting multi-byte UTF-8 characters across chunk boundaries by walking back from the cut point past any continuation bytes. Update README and doxygen with text and byte stream sending examples.
Follow the codebase convention where all opaque pointer types use the _handle_t suffix. Remove the redundant internal data_stream_t typedef — the writer now uses livekit_data_stream_handle_t directly.
Rename data_stream_descriptor_t to data_stream_reader_descriptor_t and data_stream_write_descriptor_t to data_stream_writer_descriptor_t to match the reader/writer module naming convention.
Restore data_stream_writer_handle_t as void* to match the data_stream_reader_handle_t pattern used throughout the codebase.
All writer functions now take the writer handle as first argument, matching the reader and rpc_manager patterns. The descriptor no longer stores a back-pointer to its parent writer. The public write/close functions now take the room handle so livekit.c can forward the writer handle to the internal API.
A prior global replace of livekit_data_stream_t accidentally caught livekit_data_stream_trailer_t, renaming it to the invalid livekit_data_stream_handle_trailer_t. Restore the correct name.
f7bc319 to
dcddeaa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data_stream_manager→data_stream_readerto clarify it handles incoming streams onlydata_stream_writermodule as the symmetric counterpart for outgoing streamslivekit_room_data_stream_open(),livekit_room_data_stream_write(),livekit_room_data_stream_close()generate_uuid()helper for stream identifiersCONFIG_LK_MAX_DATA_STREAMSintoCONFIG_LK_MAX_DATA_STREAM_READERSandCONFIG_LK_MAX_DATA_STREAM_WRITERSlivekit_data_stream_options_tfor the open callDesign
The writer mirrors the reader's fixed-slot pattern. Opening a stream allocates a slot, sends a header packet, and returns an opaque stream handle. Writes are auto-chunked into 15KB pieces (matching the Rust SDK). Closing sends the trailer and releases the slot. All functions follow the same handle-first convention as the reader and rpc_manager.
All packets go through the existing reliable data channel send path via
engine_send_data_packet().Usage
Test plan
idf.py buildin minimal exampleLIVEKIT_ERR_NO_MEM