Repository navigation
Description
Upstream OBS bug, reported by Bobber-bob in obsproject/obs-studio#4120 (Windows 10, OBS 26.1.1). In Studio Mode, a browser source with "Shutdown source when not visible" that is only in the Preview scene is not unloaded when it is hidden with the eye icon: showing it again brings back its old state. Fenrirthviti confirmed it in 2021 and again on 32.0.1 in 2025-10; shailander asked for an update in 2023. PatTheMav found that media sources are affected too and traced it to the scene item audio actions (2025-11). The code has not changed in this fork.
Location
libobs/obs-scene.cobs_sceneitem_set_visible()(line 3058): hiding an item whose source has audio (browser and media sources, scenes and groups) does not hide it at once. It queues an audio action, so the audio thread can apply it on a sample boundary. Adding such an item works the same way (line 2320).- The audio actions are applied by
scene_audio_render()(line 1653 when nothing plays,apply_scene_item_volume()otherwise).libobs/obs-audio.caudio_callback()(lines 598-608) only renders the active tree of the output channels. - The frontend shows the Studio Mode Preview scene with
obs_source_inc_showing(), so that scene is showing but not active. Itsscene_audio_render()never runs, the hide action stays queued, and the source keeps its show reference. Itshidecallback never fires, and "Shutdown source when not visible" never shuts it down. Hiding and showing again only adds more queued actions.
Class
Wrong behaviour: a source with audio that is hidden in a scene that is only showing keeps running as if it were visible. Removing the item works (it is applied at once).
How it is reached
- Studio Mode, a browser source with "Shutdown source when not visible" in a scene that is in the Preview and not in the Program. Hide it with the eye icon: the source is never told it is hidden. Media sources and every other source with audio take the same path.
- The same applies to every other place that only shows a scene: projectors of a scene and the multiview.
- A scene with a pending hide that leaves the Program right away (hide, then switch scenes in Studio Mode) keeps the hide queued.
Reproduced headlessly against libobs on master: a Program scene on output channel 0 and a Preview scene shown with obs_source_inc_showing(), as the frontend does. A source with audio is hidden in the Preview scene and never gets its hide callback; a video-only source does.
Upstream work
None found: no upstream PR references obsproject/obs-studio#4120 or changes how audio actions are applied. The browser-side report, obsproject/obs-browser#412, was closed in favour of the obs-studio issue.
Proposed fix and failing test
Fix: in scene_video_tick(), apply the pending audio actions of a scene that is not active. The audio thread only mixes the active tree, so such a scene mixes no audio and nothing is lost by applying them at once. Active scenes are unchanged, so the Program still fades audio on a sample boundary.
RED test (cmocka, test_preview_only_hide). It registers a source that counts its show/hide and activate/deactivate callbacks, with audio and video-only, starts core video and audio, puts a Program scene on the output and shows a Preview scene the way the frontend does. Six cases:
- hide, show and hide again an item with audio in the Preview scene, then remove it;
- hide and show a group in the Preview scene;
- hide an item in the Program scene and switch the Program to another scene right away;
- controls: the same toggling with a video-only source, removing a visible item with audio from the Preview scene, and hiding an item with audio in the Program scene.
The first three fail today and the controls pass.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 12, 2026
Claiming: this issue.
test_preview_only_hide(3 of 6 failing): counting sources with and without audio in a scene shown like the Studio Mode preview; hiding an item with audio, or a group, must reach the source's hide callback within a few ticks.PR today.
libobs: Apply scene item visibility changes in scenes that are only s…
rdoupe commentedon Oct 12, 2026
@Bobber-bob you reported this in obsproject/obs-studio#4120, so a heads-up: it's fixed here in obs-rust by #358, merged today with a regression test.
Cause: hiding a scene item whose source has audio (browser sources, media sources, groups) isn't applied at once; libobs queues it so the audio thread can fade it on a sample boundary. The audio thread only mixes the scenes that are live on Program, and the Studio Mode preview (like a projector or the multiview) is shown but not mixed, so a hide there stayed queued forever: the source never got its "hidden" event and "Shutdown source when not visible" never fired. That's the cause PatTheMav described in your thread, and Fenrirthviti confirmed it was still present last year. Now a scene that isn't being mixed applies those queued changes on the next video frame; scenes on Program behave exactly as before. The test shows a scene the way Studio Mode's preview does and hides a source with audio in it: before, the source never got hidden; now it does within a frame.
Not covered: tested with test sources in libobs, not a real browser source or the OBS UI.
Workaround on stock OBS: remove the source from the preview scene instead of hiding it, or hide it while that scene is on Program.
obs-rust is an AI-assisted fork of OBS; on Arch it's
obs-studio-rust-gitin the AUR.If you try it, a short reply here on whether your browser source shuts down when hidden in the preview would really help.
libobs: Apply scene item visibility changes in scenes that are only s…