Repository navigation
Conversation
0.13.3 exports StreamReader.close(), nextProgress(), and merges trailer attributes into the reader's info, which the following fixes rely on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The handler is given the info snapshotted when the stream opened, so attributes carried on the trailer never reached it on the native path, while the web path merges them in. Re-read the core's info once the stream ends, where it has already merged the trailer, and copy the attributes over before closing the reader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main fell back to mime(basename(path)) when no MIME type was given, but both new send paths dropped it. The Rust core does no inference and defaults to application/octet-stream, so sendFile and sendText attachments lost their type. Restore the fallback on native and web. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s cancelled onCancel only set a flag, so a pump parked in next() kept the reader, and the core kept the stream open and buffering, until the sender sent again. Call the reader's close() from onCancel: it returns at once, ends the stream in the core, and fails the pending next(), which wakes the pump to dispose the reader as before. The resulting AlreadyClosed is not reported, since nobody is listening. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd path WritableStream awaited waitForBufferStatusLow before every packet; the native pump instead chained sends straight into sendDataPacket and pulled the next batch immediately, so a large send flooded the reliable data channel. Send each packet only once the buffer is below its low-water mark, and finish a batch before pulling the next, which also keeps packet order without the separate send chain. This paces the wire and bounds what Dart holds. The core's polled queue still acknowledges packets as soon as they are buffered, so it keeps accepting them in Rust until it waits for delivery as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The core's polled queue acknowledged packets as soon as they were buffered, so sendText/sendBytes/write resolved before anything was sent, transport failures were only logged, and a send followed by disconnect could silently drop its packets. Settle each batch the core hands over: complete it once every packet went through the engine, or fail it with the error, which the core surfaces to the originating send as SendFailed. The core holds the send and produces nothing further until then, which also bounds how far sendFile reads ahead of the data channel. TEMPORARY: this needs OutgoingPacketBatch from livekit-ffi, which is not published yet, so pubspec.yaml and example/pubspec.yaml override livekit_ffi to a local rust-sdks worktree. Replace the override with a version bump once livekit-ffi releases it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes review findings against #1166 in the Dart layer around the Rust core. One commit per fix, each with a regression test that fails without it.
Warning
Not mergeable as-is. The last commit needs
OutgoingPacketBatchfrom livekit-ffi, which isn't released yet. Until then,pubspec.yamlandexample/pubspec.yamlcarry a TEMPORARYdependency_overridespointing at a local rust-sdks worktree, so CI won't build this branch. Once the rust-sdks change below is released, replace the override with alivekit_ffiversion bump.Fixes
livekit_ffito 0.13.3: exportsStreamReader.close()and merges trailer attributes into the reader's info.header{a:1} + chunk + trailer{b:2}gave{a:1}. The info is now re-read from the core when the stream ends and its attributes merged in, as the web path does.sendFileandsendTextattachments: the core does no inference and falls back toapplication/octet-stream. This restores main'soptions.mimeType ?? mime(basename(path))on native and web.onCancelonly set a flag, so the core kept the stream open and kept buffering until the sender sent again. It now calls the reader'sclose(), which returns immediately and wakes the pump. The pump still ownsdispose(), so there's no use-after-free.WritableStreamdid on main. It also sends a whole batch before pulling the next one, which replaces the separate send chain.sendText/sendBytes/writeresolved once packets were buffered in Rust, and transport errors were only logged, soawait sendText(); await room.disconnect();could silently drop the message. The pump now settles each batch: it completes the batch once its packets are through the engine, or fails it with the error, which the core surfaces to the send asSendFailed. Because the core holds the send until then, this also stopssendFilefrom reading the whole file into Rust memory.Depends on
A rust-sdks change, branch
ffi/polled-outgoing-delivery-ack, not yet pushed.OutgoingPacketQueue::on_packets_availableused to acknowledge as soon as packets were buffered, which breaks the delegate's contract (return only once the packets are on the transport).next_packets()now returns anOutgoingPacketBatchthat the host completes or fails. Closing the queue, or dropping a batch without settling it, fails the waiting send. At most one batch is outstanding.Not addressed
TextStreamInfo.operationType/versionare no longer null on native, because the core reports defaults (create/0) where main and web report null. Left as is pending a decision.reset()closes readers without an error. Intentionally deferred.Testing
flutter test: all 518 pass, run against the overridden livekit_ffi.cargo test -p livekit-ffi --no-default-features --features core-modules data_stream: all 27 pass. Clippy is clean.🤖 Generated with Claude Code