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
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
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>
This commit is contained in:
@@ -92,6 +92,34 @@ void testTrackSelection()
|
||||
ST_ASSERT(!isWantedAudioTrack(want, "other", MediaKind::Audio, MediaSource::Microphone));
|
||||
}
|
||||
|
||||
void testSubscriptionSelection()
|
||||
{
|
||||
const std::string want = "cam1";
|
||||
|
||||
// A camera source subscribes to exactly its slot's camera and mic.
|
||||
ST_ASSERT(shouldSubscribe(want, "cam1", MediaKind::Video, MediaSource::Camera, true, true));
|
||||
ST_ASSERT(shouldSubscribe(want, "cam1", MediaKind::Audio, MediaSource::Microphone, true, true));
|
||||
|
||||
// Every other participant's tracks are the bandwidth this exists to save:
|
||||
// with N sources in one OBS, each of them used to pull the whole room.
|
||||
ST_ASSERT(!shouldSubscribe(want, "cam2", MediaKind::Video, MediaSource::Camera, true, true));
|
||||
ST_ASSERT(!shouldSubscribe(want, "cam2", MediaKind::Audio, MediaSource::Microphone, true, true));
|
||||
// ...and so is the slot's own screenshare.
|
||||
ST_ASSERT(!shouldSubscribe(want, "cam1", MediaKind::Video, MediaSource::Screenshare, true, true));
|
||||
ST_ASSERT(!shouldSubscribe(want, "cam1", MediaKind::Audio, MediaSource::ScreenshareAudio, true, true));
|
||||
|
||||
// An audio-only source (the soundboard) never subscribes to video at all,
|
||||
// rather than subscribing and then disabling it.
|
||||
ST_ASSERT(!shouldSubscribe(want, "cam1", MediaKind::Video, MediaSource::Camera, false, true));
|
||||
ST_ASSERT(shouldSubscribe(want, "cam1", MediaKind::Audio, MediaSource::Microphone, false, true));
|
||||
// A video-only source does not pull the mic.
|
||||
ST_ASSERT(!shouldSubscribe(want, "cam1", MediaKind::Audio, MediaSource::Microphone, true, false));
|
||||
ST_ASSERT(shouldSubscribe(want, "cam1", MediaKind::Video, MediaSource::Camera, true, false));
|
||||
|
||||
// No selection subscribes to nothing.
|
||||
ST_ASSERT(!shouldSubscribe("", "cam1", MediaKind::Video, MediaSource::Camera, true, true));
|
||||
}
|
||||
|
||||
void testStateMachineHappyPath()
|
||||
{
|
||||
SessionStateMachine m;
|
||||
@@ -527,6 +555,7 @@ int main()
|
||||
{
|
||||
testFrameGeometry();
|
||||
testTrackSelection();
|
||||
testSubscriptionSelection();
|
||||
testStateMachineHappyPath();
|
||||
testPublisherSwapIsNotAnError();
|
||||
testReconnect();
|
||||
|
||||
Reference in New Issue
Block a user