Skip to content

rust: Port the media action admission decisions in obs-source.c to obs-source #2239

Closed

Description

@rdoupe

Unit

Port the media action admission decisions in libobs/obs-source.c.h to rust/obs-source, as a new module media_admission. These decisions move:

  • In obs_source_media_play_pause, _restart, _stop, _next, _previous, _get_duration, _get_time, _set_time, _get_state, _started and _ended: whether the action is accepted. That means a valid source that is controllable (OBS_SOURCE_CONTROLLABLE_MEDIA) and has the matching callback. It also covers each getter's fallback value (0, OBS_MEDIA_STATE_NONE).
  • In process_media_actions: the action dispatch table, mapping each queued action to the callback it calls and the signal it emits.

These stay in C: the action queue and its mutex, the plugin callbacks, the signals, and the source refs.

obs-websocket reaches this path through TriggerMediaInputAction and SetMediaInputCursor.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-source-media-admission.c.h, as hidden functions.
  2. Characterization in test_source_media_admission_steps. It covers:
    • every action × controllable flag × callback present or absent;
    • each getter's fallback;
    • the dispatch for every action, plus a value outside the enum.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-source-media-admission group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C, exhaustive over the flags, plus a deliberate-break check and port_comparison numbers.

Every media and websocket media test must stay green on every lane: grep test/cmocka for media_ and ws_media.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2239, the media action admission decisions in libobs/obs-source.c.h, ported to rust/obs-source as media_admission.

    1. Move the accept decisions of the obs_source_media_* functions, the getters' fallbacks and the process_media_actions dispatch into a hidden libobs/obs-source-media-admission.c.h, with no change in behaviour (exports stay 1766).
    2. Characterization: test_source_media_admission_steps (every action × controllable flag × callback present/absent, each getter's fallback, every queued action plus one outside the enum).
    3. RED: Tier 1 tests against todo!() shims.
    4. GREEN: the safe core plus shims in a libobs.ported-source-media-admission group. The queue, its mutex, the callbacks, the signals and the refs stay C.
    5. Tier 3: an oracle over the unchanged C, exhaustive parity, a mutation table and port_comparison numbers.
    6. Docs.

    I stay off the lines #2208 and #2215 touch. PR expected within a day.

  2. added
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 24, 2026
  3. moved this from In progress to Done in obs-rust Multiviewon Oct 25, 2026
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

    claimedAn agent or person has claimed this; check the claim comment before starting

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions