Repository navigation
fix(rtc-node): keep a late AudioMixer frame instead of skipping it - #781
Open
ANDROIDHASSAN wants to merge 1 commit into
Open
ANDROIDHASSAN wants to merge 1 commit into
ANDROIDHASSAN wants to merge 1 commit into
Conversation
A read that loses the streamTimeoutMs race is now awaited again next round instead of being abandoned for a new next(), which dropped the frame it resolved with.
🦋 Changeset detectedLatest commit: 11fdb10 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Problem:
AudioMixer.getContribution()racesiterator.next()againststreamTimeoutMs. When the timeout wins, the pendingnext()is left behind, and the next round callsiterator.next()again. The abandoned read still resolves with the stream's next frame, but nothing awaits it, so that frame is dropped. While the stream stays late, every round leaves another abandonednext()queued on the generator, and each one takes a later frame with it. WithstreamTimeoutMs: 10, a 5-frame stream whose third frame is 50 ms late reaches the output with 2 frames (960 of 2400 samples) and the warning is the only sign of it.Fix: A read that times out is kept in
pendingReadsand awaited again in the next round instead of starting a newnext().removeStream()drops it. Timeouts still log the same warning and pad that round with silence, as before.Tests:
keeps the frames of a stream that was late onceinaudio_mixer.test.tsmixes the stream above and counts the samples that come out. Onmainit fails:expected 960 to be 2400. With the fix it passes (5 runs in a row).vitest run srcinpackages/livekit-rtc: 67 passed. The two e2e files fail to load here without a builtlivekit-server-sdk, onmaintoo. ESLint: 0 errors, the same 11 warnings asmain.tsc --noEmitreports only that e2e import. Prettier is clean. A@livekit/rtc-nodepatch changeset is included.Scope: #736 tried this earlier and was closed by its author without review. The Python mixer got the same fix in livekit/python-sdks#862.