Conversation
Exclude audio and video stream events before scheduling room callbacks, while preserving publication and other request callbacks. Add regression coverage for dispatch filtering, publish/unpublish completion, and subscription cleanup.
swayamg20
requested review from
cloudwebrtc,
lukasIO and
xianshijing-lk
as code owners
September 17, 2026 08:45
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
Fixes #812.
Filter
audio_stream_eventandvideo_stream_eventfrom the long-lived subscription created byRoom.connect(). Audio/video streams already have their own subscriptions, so forwarding these events to every room only adds event-loop callbacks and room-queue work.Keep all other events eligible, including the
publish_trackandunpublish_trackcallbacks thatLocalParticipantreceives through the room queue. The temporary connect subscription andAudioSource.capture_frame()are unchanged.Thanks to @wizd for the report and the correction identifying the publication-callback requirement. The separate publication-state robustness issue is intentionally out of scope. This change also leaves the connection-cancellation work in #813 untouched.
Regression coverage
The new tests exercise the real room connection, FFI queue, room listener, and participant publication methods with a fake native request boundary:
Reverting only the filter makes both media regressions fail: 100 media events schedule 200 callbacks instead of the expected 100. Restoring it passes all eight new cases. This is deterministic dispatch-count evidence, not a production throughput benchmark.
Validation
tests/andlivekit-rtc/tests/suite: 121 passed, 72 skipped on Python 3.13.12/macOS arm64. Live-server credentials were unset.git diff --check: passed.Local fixture note: git-lfs is unavailable in this checkout. The full-suite run used the exact upstream WAV files in a temporary directory, verified against the tracked LFS SHA-256 hashes; a pytest collection hook redirected only the three audio test modules' fixture directory. No assertions or tracked fixtures were changed. The existing JWT test-key and AudioStream test-double destructor warnings remain (34 warnings). Skipped/live-server tests have not been validated.