-
Notifications
You must be signed in to change notification settings - Fork 112
Port data streams over to rust livekit-ffi version #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
1egoman
wants to merge
13
commits into
main
Choose a base branch
from
use-rust-data-streams
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
72a7177
feat: port data streams over to rust livekit-ffi version
1egoman f5dfc66
fix: add missing changeset
1egoman 5f1c007
feat: add compress and data stream options
1egoman d5d7ede
fix: ensure that end of stream errors are exposed into the read strea…
1egoman 1fa5e96
fix: satisfy prettier in participant.ts
1egoman 7899ac9
fix: add sdk default into doc comment
1egoman d93b835
feat: add initial e2e tests
1egoman bcf014a
fix: switch e2e test prng mechanism to something more conventional
1egoman f496f5d
fix: drop Date.now() dependencies in e2e tests
1egoman 699b94b
fix: ensure that progress measurements are tracked in bytes always
1egoman a6f8a35
fix: ensure that abandoned data stream writers are closed on room dis…
1egoman 592699e
Update packages/livekit-rtc/src/utils.ts
1egoman a32e2e6
fix: update structure of makeLocalParticipant mock to take into accou…
1egoman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@livekit/rtc-node': patch | ||
| --- | ||
|
|
||
| Convert data streams to use livekit-ffi exposed data streams interface |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Long incoming text streams hold the entire message in memory until they finish
Every piece of an incoming text stream is kept in an internal lookup table (
this.receivedChunks.set(index, chunk)atpackages/livekit-rtc/src/data_streams/stream_reader.ts:115) even after it has already been handed to the caller, so memory keeps growing with the whole message instead of staying flat while it is consumed piece by piece.Impact: An application that reads a large or long-running text stream incrementally still accumulates the full payload in memory, which can exhaust memory now that incoming streams may be up to 5 GB.
Why the retained map can never be pruned under the new receive path
TextStreamReader.handleChunkReceivedstores each chunk keyed bychunkIndexpurely so it can drop an olderversionof the same index (packages/livekit-rtc/src/data_streams/stream_reader.ts:108-116). The new FFI-backed receive path synthesizes chunks itself with onlycontentand a monotonically increasingchunkIndexand never setsversion(packages/livekit-rtc/src/room.ts:1050-1052, and the byte path atpackages/livekit-rtc/src/room.ts:984-986), so the de-duplication branch is now dead and the map is pure retention. Entries are only released when the iterator observesdoneor an error (packages/livekit-rtc/src/data_streams/stream_reader.ts:141,154), i.e. at the very end of the stream. Since v2 no longer re-sends versioned chunks, the map (and thebigIntToNumber(chunk.chunkIndex!)bookkeeping around it) can be dropped entirely, leaving only the byte-progress accounting from the base class.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.