Repository navigation
fix(rtc): finish AudioMixer iteration when closed - #876
Open
Apeksha9389 wants to merge 3 commits into
Open
Apeksha9389 wants to merge 3 commits into
Apeksha9389 wants to merge 3 commits into
Conversation
Apeksha9389
requested review from
changt,
cloudwebrtc,
lukasIO and
xianshijing-lk
as code owners
October 20, 2026 11:38
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.
AudioMixer.aclose()cancels the producer without waking a consumer already awaiting the next frame. A task draining the mixer can therefore remain blocked after close returns. Afterend_input()finishes naturally, a secondanext()also waits forever because the end marker was already consumed.Track completed iteration explicitly and signal the output queue when closing. Immediate close discards queued output before inserting the end marker, so a full bounded queue cannot block shutdown. Natural
end_input()still drains buffered audio before exhaustion. Readers retain the terminal marker so already-blocked readers can also observe it.Three new regressions fail on unchanged main: a waiting consumer during close, repeated reads after natural exhaustion, and close with a full output queue. With the fix, all 37 tests in the mixer, FFI queue, emitter and broadcast-queue suites pass. Ruff check/format and targeted MyPy pass on Python 3.12. These tests use real Python mixer/frame objects; no LiveKit server or native FFI was needed. Two additional regression cases cover concurrent readers under immediate close and natural exhaustion; both fail before the review fix. Live call and cross-platform integration tests were not run.
Prepared with AI assistance and reproduced locally.