feat(session): subscribe only to the slot's own camera and mic #8

Merged
jknapp merged 1 commits from feat/selective-subscribe into main 2026-10-05 01:33:34 +00:00
Owner

Why

Every plugin source connected with auto_subscribe on, so each pulled every camera in the room and discarded all but one. In the 2026-10-04 old-gods-of-appalachia show (8 sources, 7 cameras), each source carried 4–7 Mbps and all 8 hit congestion in the same instant: they share the director's one downlink, so the SFU starved the cameras actually on screen.

What

  • auto_subscribe = false; the session calls setSubscribed(true) on exactly the slot's camera + mic: at connect, on onTrackPublished, and after reconnect.
  • SDK 1.10.1 delivers TrackPublishedEvent::publication null, so that handler re-sweeps the participant's publication map (subscribe-only, never re-attaches the live camera).
  • Any subscription not asked for is logged and handed back (setSubscribed(false)).
  • Audio-only sources never subscribe to video (replaces subscribe-then-setEnabled(false)).

Verified

Against a real livekit-server 1.13.6 (--dev):

  • New bystander-camera check fails before this change (3 unwanted subscriptions), passes after.
  • New full leave/rejoin-as-new-session step passes (the real-world "reload to unstick" case).
  • Full ctest green; integration test 4 consecutive runs, 49/49 each.

Not verified

  • In the OBS GUI / a live show. Needs the director to install the new DLL and a show's LiveKit logs compared for simultaneous channel congestion detected across obs:* participants.

🤖 Generated with Claude Code

## Why Every plugin source connected with `auto_subscribe` on, so each pulled **every camera in the room** and discarded all but one. In the 2026-10-04 `old-gods-of-appalachia` show (8 sources, 7 cameras), each source carried 4–7 Mbps and all 8 hit congestion in the same instant: they share the director's one downlink, so the SFU starved the cameras actually on screen. ## What - `auto_subscribe = false`; the session calls `setSubscribed(true)` on exactly the slot's camera + mic: at connect, on `onTrackPublished`, and after reconnect. - SDK 1.10.1 delivers `TrackPublishedEvent::publication` **null**, so that handler re-sweeps the participant's publication map (subscribe-only, never re-attaches the live camera). - Any subscription not asked for is logged and handed back (`setSubscribed(false)`). - Audio-only sources never subscribe to video (replaces subscribe-then-`setEnabled(false)`). ## Verified Against a real `livekit-server` 1.13.6 (`--dev`): - New bystander-camera check **fails before** this change (3 unwanted subscriptions), passes after. - New full leave/rejoin-as-new-session step passes (the real-world "reload to unstick" case). - Full ctest green; integration test 4 consecutive runs, 49/49 each. ## Not verified - In the OBS GUI / a live show. Needs the director to install the new DLL and a show's LiveKit logs compared for simultaneous `channel congestion detected` across `obs:*` participants. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jknapp added 1 commit 2026-10-05 01:00:43 +00:00
feat(session): subscribe only to the slot's own camera and mic
Build / Linux (ubuntu-24.04) (push) Successful in 1m8s
Build / macOS (macos-latest) (push) Successful in 1m9s
Build / macOS (macos-latest) (pull_request) Successful in 44s
Build / Windows (windows-latest) (push) Successful in 7m0s
Build / Windows (windows-latest) (pull_request) Successful in 4m14s
Build / Linux (ubuntu-24.04) (pull_request) Failing after 42m30s
7723082795
Every plugin source connected with auto_subscribe on, so each one pulled
every camera in the room and discarded all but one. In the 2026-10-04
old-gods-of-appalachia show (8 sources, 7 cameras) each source carried
4-7 Mbps and all 8 hit congestion in the same instant: they share the
director's single downlink, so the SFU starved the cameras on screen.

The session now connects with auto_subscribe off and calls
setSubscribed(true) on exactly the wanted publications: at connect, on
onTrackPublished (re-sweeping the participant, since SDK 1.10.1 delivers
that event's publication null), and after a reconnect. Any subscription
it did not ask for is reported and handed back. Audio-only sources no
longer subscribe-then-disable video; they never subscribe to it.

The integration test gains a bystander camera that must never be
subscribed (fails with 3 unwanted subscriptions before this change) and
a full publisher leave/rejoin as a new participant session.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
jknapp merged commit dc5ffc9938 into main 2026-10-05 01:33:34 +00:00
jknapp referenced this issue from a commit 2026-10-05 01:34:36 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CyberCoveLLC/obs-streamer-tools-plugin#8