Repository navigation
requesthandler: Save the collection after changes - #12
Merged
Merged
Conversation
This was referenced Oct 15, 2026
Requests that change scenes, inputs, filters, scene items or transitions (SetInputVolume, SetInputSettings, SetSceneItemTransform, ...) changed only the live state. The change was on disk only after the next save, so a crash or a hard stop lost it. A change in the OBS UI saves at once. After a request from an explicit list succeeds, ProcessRequest now queues obs_frontend_save() for the UI thread without waiting. OBSBasic::SaveProject() defers the write, so a burst of requests results in one save. Scene switches are not in the list: the UI does not save on a scene switch either. Fixes obs-rust/obs-studio#811 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vpacher
force-pushed
the
fix/save-scene-collection
branch
from
October 16, 2026 11:09
82cf737 to
fe628a3
Compare
zackees
approved these changes
Oct 16, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Reviewed. One commit on top of master 2542c6a (ahead 1, behind 0, includes #13). Hook sits after a successful handler in ProcessRequest, so batches get it too. Scene switches excluded as described. obs_frontend_save is already available via RequestHandler.h. Behaviour is covered by test_ws_save_changes in obs-rust/obs-studio#812 (RED a8dcfd4). Code Quality is only waiting for first-contribution approval; master has no protection, merging.
vpacher
added a commit
to vpacher/obs-studio
that referenced
this pull request
Oct 16, 2026
Move plugins/obs-websocket to f06b040 (obs-rust/obs-websocket#12): after a successful request that changes the scene collection (SetInputVolume, SetInputSettings, SetSceneItemTransform, ...), the request handler queues obs_frontend_save() for the UI thread without waiting. Before, these changes stayed in memory until a clean exit, and a crash or a hard stop lost them. Scene switches are not saved, as in the UI. GREEN for obs-rust#811 (RED f8974ca: a successful SetInputVolume queued 0 UI tasks). With the same fix commit (82cf737, identical to the merged change) test_ws_save_changes passed 3 of 3 locally on Debian 13; the PR CI runs it on this commit. Fixes obs-rust#811. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vpacher
added a commit
to vpacher/obs-studio
that referenced
this pull request
Oct 16, 2026
* test/cmocka: Test that websocket changes are saved test_ws_save_changes compiles the plugin request handlers from the submodule against real libobs and the frontend API library. It sends requests through RequestHandler::ProcessRequest and counts the tasks queued for the UI thread, where the save runs. RED for obs-rust#811: a successful SetInputVolume queues 0 tasks; 1 (the save) is expected. GetInputVolume and a failed SetInputVolume queue none and pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * obs-websocket: Save the collection after changes Move plugins/obs-websocket to f06b040 (obs-rust/obs-websocket#12): after a successful request that changes the scene collection (SetInputVolume, SetInputSettings, SetSceneItemTransform, ...), the request handler queues obs_frontend_save() for the UI thread without waiting. Before, these changes stayed in memory until a clean exit, and a crash or a hard stop lost them. Scene switches are not saved, as in the UI. GREEN for obs-rust#811 (RED f8974ca: a successful SetInputVolume queued 0 UI tasks). With the same fix commit (82cf737, identical to the merged change) test_ws_save_changes passed 3 of 3 locally on Debian 13; the PR CI runs it on this commit. Fixes obs-rust#811. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Description
After a request that changes the scene collection succeeds,
RequestHandler::ProcessRequest()now queuesobs_frontend_save()for the UI thread (obs_queue_task(OBS_TASK_UI, ..., false)). The list of requests is in the newsrc/requesthandler/SceneCollectionChanges.h: the requests that change scenes, inputs, filters, scene items or transitions, plusSetSourcePrivateSettings.SetCurrentProgramScene,SetCurrentPreviewScene,TriggerStudioModeTransition) are not in the list. The UI does not save on a scene switch either.OBSBasic::SaveProject()defers the write, so a burst of requests results in one save.Motivation and Context
Fixes obs-rust/obs-studio#811.
SetInputVolume,SetInputSettings,SetSceneItemTransformand similar requests changed only the live state. The change was on disk only after the next save, so a crash or a hard stop lost it. A change in the OBS UI saves at once. Upstream obsproject/obs-websocket master has the same code.How Has This Been Tested?
Tested OS(s): Debian 13 (headless Xorg, OBS started by a systemd unit).
test_ws_save_changesin obs-rust/obs-studio (draft PR, RED commit a8dcfd4): sends requests throughProcessRequestagainst real libobs and counts the queued UI tasks. RED: a successfulSetInputVolumequeues 0 tasks (1 expected); GREEN with this commit: 3 of 3 pass.SetInputVolume, while OBS keeps running, and the value surviveskill -9and a restart.Types of changes
Checklist:
masteror arelease/*branch.🤖 Generated with Claude Code