Repository navigation
libobs: Mute 32.x Monitor Only sources on load - #2445
Conversation
A source saved before 33.0 with "Monitor Only" loads with monitoring on, which 33.0 plays into every output, and it stays unmuted, so its audio reaches the stream and recordings. Load scene collection entries saved by 32.2.2 and 33.0.0 with each monitoring type, feed a tone, and check the monitoring and mute state, the program mix and the monitor feed. Refs obs-rust#2444
33.0 turned monitoring into an on/off switch where on means monitor and output, and the monitor now plays a source while it is muted. The load migration turned every saved monitoring type but off into monitoring on and left the mute alone, so an unmuted source set to "Monitor Only" before 33.0 started playing into the stream and recordings. A source saved before 33.0.0 whose monitoring type (after the 23.2.2 monitor-by-default migration) is Monitor Only now also loads muted, the 33.0 form of monitor-only. Monitor and Output and off load as before, and a source saved by 33.0.0 or later is not touched. obs_source_load_monitor_only_mutes() is a new hidden pure function in obs-source-load.c, ported to obs-core::source_load with its shim, oracle and parity tests; the monitoring plan struct is unchanged. Fixes obs-rust#2444
|
Coordinator review: the change is right. 33.0 turns pre-33 Monitor Only into monitoring on, unmuted, so those sources leak into the stream, and loading them muted restores the old behavior. It only applies to sources saved before 33.0.0, so 33.0 scenes don't change. RED fbbaf6472 then GREEN on C, hybrid and the libobs C reference. The C-vs-Rust parity tests cover the new function. The existing C test only gains cases, and the symbol is hidden and listed in the export maps. The ledger line is there. |
|
The placeholders are fixed (752faee). Queued; it merges when CI is green. |
…2447) Since 33.0, monitoring is on or off, on means monitor and output, and the monitor ignores mute, so Monitor Only is monitoring on plus muted (obs-rust#2445 loads old scene collections that way). The deprecated obs_source_set_monitoring_type() turns every type but none into monitoring on and leaves the mute alone, so a source set to Monitor Only by a plugin, a script or obs-websocket's SetInputAudioMonitorType plays into the stream and recordings. obs_source_get_monitoring_type(), GetInputAudioMonitorType and the "audio_monitoring" signal report Monitor and Output for it. test_source_monitoring_type calls the libobs setter and getter; test_ws_monitor_only goes through the unchanged obs-websocket input requests, compiled against libobs. Both play a tone from a source on the program and check the mixed audio libobs hands to outputs and the monitor feed after each step: Monitor Only must keep the tone out of the mix and read back as Monitor Only; the other types must round-trip; leaving Monitor Only must undo its mute but keep any other mute; a monitored, muted source must read back as Monitor Only. Refs obs-rust#2447
…st#2450) * test/cmocka: Add failing tests for Monitor Only monitoring (obs-rust#2447) Since 33.0, monitoring is on or off, on means monitor and output, and the monitor ignores mute, so Monitor Only is monitoring on plus muted (obs-rust#2445 loads old scene collections that way). The deprecated obs_source_set_monitoring_type() turns every type but none into monitoring on and leaves the mute alone, so a source set to Monitor Only by a plugin, a script or obs-websocket's SetInputAudioMonitorType plays into the stream and recordings. obs_source_get_monitoring_type(), GetInputAudioMonitorType and the "audio_monitoring" signal report Monitor and Output for it. test_source_monitoring_type calls the libobs setter and getter; test_ws_monitor_only goes through the unchanged obs-websocket input requests, compiled against libobs. Both play a tone from a source on the program and check the mixed audio libobs hands to outputs and the monitor feed after each step: Monitor Only must keep the tone out of the mix and read back as Monitor Only; the other types must round-trip; leaving Monitor Only must undo its mute but keep any other mute; a monitored, muted source must read back as Monitor Only. Refs obs-rust#2447 * libobs: Keep Monitor Only out of the outputs when set by type Since 33.0, monitoring is on or off, on means monitor and output, and the monitor plays a source even when it is muted. The deprecated obs_source_set_monitoring_type() turned Monitor Only into monitoring on and left the mute alone, so a source that a plugin, a script or obs-websocket's SetInputAudioMonitorType set to Monitor Only played into the stream and recordings. Monitor Only now mutes the source, then turns monitoring on, as a pre-33.0 Monitor Only source loads (obs-rust#2444). Monitor and Output unmutes it and turns monitoring on. None turns monitoring off and keeps the mute, except that it undoes the mute Monitor Only set when nothing has set the mute since, so the source plays into the outputs as None did before 33.0. obs_source_set_muted() clears that mark. The getter and the "audio_monitoring" signal report a monitored, muted source as Monitor Only; the stored type and the saved scene collection are unchanged. Fixes obs-rust#2447 * docs: Note that Monitor and Output unmutes a source Refs obs-rust#2447
Fixes #2444
What and why
33.0 made audio monitoring an on/off switch where on means monitor and output, and the monitor now plays a source while it is muted, so "monitor only" in 33.0 is monitoring on + muted. The load migration (upstream obsproject/obs-studio@646836a, ported unchanged to
obs-core::source_load) turns every saved type except off into monitoring on and leaves the mute alone. So an unmuted source set to "Monitor Only" before 33.0 started playing into the stream and recordings after the upgrade.Now a source saved before 33.0.0 whose monitoring type is Monitor Only (after the 23.2.2 monitor-by-default migration) also loads muted. Monitor and Output and off load as before. A source saved by 33.0.0 or later is not touched (33.0 saves
prev_ver33 and type 2 or 0), so no scene that has already been saved by 33.0 sounds different. This restores the pre-33 behaviour; it adds no option.obs_source_load_monitor_only_mutes(): a new hidden pure function inlibobs/obs-source-load.c.h(declared withoutEXPORT, listed inrust-hidden.txt,rust-exports.mapandrust-unexports-macos.txt).obs_load_source_type()callsobs_source_set_muted(source, true)when it returns true, after the monitoring setter.obs-core::source_load::monitor_only_muteswith its C ABI shim. The oracle compiles the C function under theoracle_prefix. The monitoring plan struct and its layout are unchanged, so no existing test changes.test_source_load_migration_stepsgains two new cases for the new function.Not in this PR: the stinger transition's old three-way
audio_monitoringsetting is also lost on upgrade (#2444-stinger). Transitions are saved with no version, so a stinger cannot be migrated without changing stingers already saved by 33.0. That is held for a design decision.RED → GREEN
fbbaf6472(test: Keep a 32.x Monitor Only source out of the mix), addingtest_source_monitor_only_load(graphics suite, Linux, under xvfb). On master,legacy_monitor_only_stays_out_of_programfails on all three lanes (C, hybrid, libobs-c-reference): "32.2.2 Monitor Only, unmuted: monitoring on, muted no, 1024 program frames ... carry the tone". The other two cases pass: the other pre-33 types, and entries saved by 33.0.0.79ba9cb69.test_source_monitor_only_load3/3 on C, hybrid and libobs-c-reference: "32.2.2 Monitor Only, unmuted: monitoring on, muted yes, 0 program frames and 28800 monitor feed frames carry the tone".test_source_load_migration_steps,test_source_volume_mix,test_source_audio_ranges,test_deinterlace_mode_load,test_source_audio_render_stepsandtest_source_volume_apply_stepspass on C and hybrid. Rustobs_core::source_load*: 44/44, including the new step tests, the exhaustive parity test against the C (every caps bit × 30 types × 80 versions) and the proptest parity. The exported symbol sets are identical on C, hybrid and libobs-c-reference (1766 each); the new function is a local symbol.Checklist
masterdocs/features.mdis added or updated-W..., ratchets): not applicable