libobs: mix scene-item audio when item canvas is unset#738
Merged
Conversation
scene_audio_render_do gated each scene item's audio on an exact canvas match, but a scene item whose canvas is NULL (the default until obs_sceneitem_set_canvas is called) matched no canvas, so its audio was dropped on every canvas while its video still rendered. Add the item->canvas != NULL escape hatch that the video path (scene_video_render) already has, so a NULL item canvas means "mix into every canvas". Ref: streamlabs/obs-studio-node#1493 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
|
Regression test for this fix: streamlabs/obs-studio-node#1724 |
aleksandr-voitenko
approved these changes
Jun 12, 2026
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.
Problem
A source's audio plays when the source is set directly as an output channel, but goes silent once the source is wrapped in a scene and the scene is the output source. Reported in streamlabs/obs-studio-node#1493.
Root cause
scene_audio_render_do(libobs/obs-scene.c) mixes each scene item's audio only into a canvas whose pointer exactly matchesitem->canvas:A scene item's
canvasdefaults toNULL(scene items are zero-allocated; it is only set viaobs_sceneitem_set_canvas, e.g. osn'ssceneItem.video). With a NULL canvas the comparison never matches, so the item's audio is dropped on every canvas — while its video still renders, because the video path (scene_video_render) already special-cases NULL:The asymmetry dates to the video path gaining its
!= NULLguard ("Fix video mix canvas identity", #720) while the audio path — rewritten separately inda3255b9— did not.Fix
Give the audio path the same escape hatch: a NULL item canvas means "mix into every canvas".
Test
Regression test mirroring the exact obsproject#1493 repro (scene-wrapped
ffmpeg_sourcewith the item canvas left unset must record non-silent audio): streamlabs/obs-studio-node PR — link added below.Notes
🤖 Generated with Claude Code