Skip to content

rust: port process_media_actions (the media action queue drain) to obs-source #5902

Done

Description

@rdoupe

process_media_actions() in libobs/obs-source.c.h is still C. It is the last C step of the media control path: the obs_source_media_* calls that fill source->media_actions are Rust since #5617, and the dispatch and signal decisions it asks are Rust since #2257 (obs-source-media-admission). obs_source_video_tick() runs it once per tick for a source with OBS_SOURCE_CONTROLLABLE_MEDIA.

Behavior the port keeps:

  • Loops until the queue is empty: each round takes media_actions_mutex, copies and pops the front action (or sets MEDIA_ACTION_NONE when empty), and drops the lock before any callback, so a callback may queue more actions and they run in the same tick.
  • Asks obs_source_media_dispatch() for the step; RETURN ends the loop, SKIP calls nothing.
  • Calls the matching info.media_* callback with context.data (action.pause for play/pause, action.ms for set time), callback before signal.
  • Emits obs_source_media_signal() through obs_source_dosignal(source, NULL, ...), reading action.pause only for play/pause.

Plan (the shape of #5900): move the body verbatim into its own reference-only file in a ported group; a safe core in obs-source over a trait (pop front under the lock, call, signal); the C entry through hidden, non-EXPORT adapters next to obs-source-media-controls-fields.c.h; Tier 1 RED against todo!() in obs-source's existing source test binary; Tier 3 parity against the original C in obs-c-oracle; Tier 2 unchanged plus a cmocka case that queues every action type through the public obs_source_media_* calls, ticks the source, and checks the callback order, arguments and signals, including an action queued from inside a callback.

Activity

  1. rdoupe commented on Nov 28, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: port process_media_actions to obs-source

    1. Characterize the drain loop with a cmocka case through the public obs_source_media_* calls and a tick.
    2. Extract the body verbatim, Tier 1 RED against todo!(), then GREEN with Tier 3 parity against the C oracle.
    3. Open the PR once the claim is accepted.
  2. added
    enhancement
    port
    on Nov 28, 2026
  3. added
    ready
    on Nov 28, 2026
  4. moved this from In progress to In review in obs-rust Multiviewon Nov 29, 2026
  5. added a commit that references this issue on Nov 29, 2026
    bcaa2f7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementportready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions