Skip to content

obs-websocket: RemoveInput keeps the scene items of the input in scenes that are not rendered #1613

Closed
obs-rust/obs-websocket
#20

Description

@vpacher

Problem

The protocol documentation says that RemoveInput "will immediately remove all associated scene items". It does not. The request returns success, but the input and its scene items stay in each scene that is not rendered. GetSceneItemList and GetInputList continue to show them.

RequestHandler::RemoveInput() (src/requesthandler/RequestHandler_Inputs.cpp) calls only obs_source_remove(). libobs does not remove the scene items of a removed source at that time. It removes them later, in update_transforms_and_prune_sources(), which runs only from scene_video_render() or from obs_scene_prune_sources(). Thus:

  • In a scene that is on program or preview, the items go away on the next frame.
  • In a scene that is not rendered (not on program, not in Studio Mode preview, not nested in a rendered scene, no projector), the items stay until that scene is rendered or until OBS restarts.

While the items stay, scene_save() writes them to the scene collection, but obs_save_sources() skips the removed source. On the next load, each of these items gives a "source not found" warning.

The frontend does not have this problem: after obs_source_remove() for a scene, RemoveSceneAndReleaseNested() (frontend/widgets/OBSBasic_Scenes.cpp.hpp) calls obs_scene_prune_sources() on all scenes.

Upstream obs-websocket and upstream OBS have the same code.

Measured

obs-rust master (33.0.0-beta6 line), Linux, headless. Program scene = "Scene", Studio Mode off.

  1. CreateScene "zz test" (not rendered).
  2. CreateInput in "zz test", kind color_source_v3.
  3. RemoveInput → success.
  4. GetSceneItemList("zz test") and GetInputList after 0 s, 2 s and 5 s: the item and the input are still there.
  5. RemoveScene("zz test"): the frontend prunes all scenes; the item and the input go away.

Proposed fix

In RemoveInput, after obs_source_remove(), call obs_scene_prune_sources() on each scene (obs_enum_scenes(), source id scene), as the frontend does. Groups are pruned through their parent scene.

Test

A cmocka test (pattern of test_ws_current_scene_removed) that compiles the plugin's input requests against real libobs. It adds an input to a scene that is not rendered, sends RemoveInput, and checks that the scene has no item for the input when the request returns.

I will make the PR (RED, then GREEN; the fix in obs-rust/obs-websocket, then the submodule update) and verify it on a headless Linux OBS.

Activity

  1. vpacher commented on Oct 21, 2026

    @vpacher
    MemberAuthor

    Claiming: #1613

  2. added
    claimedAn agent or person has claimed this; check the claim comment before starting
    and removed
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 21, 2026
  3. zackees commented on Oct 23, 2026

    @zackees
    Member

    @vpacher are you still on this? The claim is past 48 h with no PR. If you've moved on, reply Releasing #1613 (or say nothing for another day) and I'll pick it up: prune the removed source's scene items in Rust OBS so the unchanged obs-websocket RemoveInput matches its documented behavior.

  4. vpacher commented on Oct 24, 2026

    @vpacher
    MemberAuthor

    Yes, I am still on this. The fix is in obs-rust/obs-websocket#20 (opened 10-21). The claim bot does not see PRs in other repositories, so it shows no PR on this issue.

    #20 changes RemoveInput to call obs_scene_prune_sources() on every scene of every public canvas after obs_source_remove(). The frontend does the same after it removes a scene. The scene items of the input are then removed before the request returns, as the protocol documents. If you prefer the prune in Rust OBS core (so that an unchanged obs-websocket works), tell me and I will move the fix there.

  5. zackees commented on Oct 24, 2026

    @zackees
    Member

    Thanks, keep it in obs-websocket#20. Upstream OBS has the same libobs behavior and upstream obs-websocket the same bug, so pruning in the request handler (as the frontend does) is a plain plugin bug fix, not a change made for Rust OBS. Moving it into libobs would change obs_source_remove() semantics relative to upstream, which Tier 2/3 parity would then have to explain. Once #20 merges, the submodule bump here closes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions