Skip to content

rust: Port the output stop routing in obs-output.c to obs-output #2535

Closed

Description

@rdoupe

Rust port, round 9 unit 4: the output stop and end-capture routing in libobs/obs-output.c.h, moved to obs-output.

Scope

Rust takes over these decisions:

  • obs_output_stop: the delayed stop of an encoded output with a delay running;
  • end_data_capture_thread: the encoded or raw stop, which encoder callback is released (process_delay, interleaved or default; the interleave test reuses obs_output_raw_audio_interleave), which encoders or raw connections stop by flag, the service deactivation and the delay cleanup;
  • stop_raw_audio: which mixes are disconnected with raw_audio2 (reusing obs_output_raw_audio_mix_on; the first mixer is already obs_output_first_mixer);
  • obs_output_end_data_capture_internal: the unstarted-encoder shutdown for an encoded output, whether restart refs keep the delay, the frame log for video outputs, and the thread-creation fallback (both threads).

C keeps every atomic load and store where it is today (active, data_active, reconnecting, delay_active, delay_capturing, delay_restart_refs, end_data_capture_thread_active) and the stopping event, so each is tested in its current && order; also the joins and pthread_create (their results passed in), the unpause, info.stop, obs_output_end_data_capture, obs_output_delay_stop, obs_encoder_stop, stop_raw_video, audio_output_disconnect, obs_service_deactivate, obs_output_cleanup_delay, log_frame_info, the caption frees, the keyframe tracking clear, the stop params copied before the threads start, and every signal and log. obs_output_force_stop, obs_output_actual_stop and obs_output_signal_stop's non-reconnect branch decide only on single atomics, so they stay as they are; the reconnect policy stays C.

Plan

The standard six commits:

  1. move;
  2. characterization test;
  3. Tier 1 RED;
  4. GREEN in a libobs.ported-* group;
  5. Tier 3 parity;
  6. docs.

Activity

  1. added
    enhancement
    port
    on Oct 26, 2026
  2. rdoupe commented on Oct 26, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2535.

    1. Move the stop decisions to libobs/obs-output-stop.c.h, one function per decision on plain values, behaviour-neutral (checked with a move harness).
    2. Characterization test (test_output_stop_steps).
    3. RED: Tier 1 tests of a new obs-output::output_stop module against todo!() stubs.
    4. GREEN: the core plus src/ffi/output_stop.rs, in libobs.ported-output-stop.
    5. Tier 3 parity against the C, with a mutation check.
    6. Docs.

    Draft PR once the RED commit exists, within the day.

  3. added
    ready
    on Oct 26, 2026
  4. rdoupe commented on Oct 27, 2026

    @rdoupe
    CollaboratorAuthor

    Fixed by PR #2536 (merged through the merge queue): the output stop and end-capture decisions of libobs/obs-output.c.h now live in rust/obs-output (module output_stop), reached through seven hidden C shims in the new libobs.ported-output-stop group, with Tier 1, Tier 2, Tier 3 and a mutation check.

    What is left: nothing in this unit's scope. Every atomic load and store, join, thread creation, signal and log stays C where it was. The plan's larger route functions (stop_route, end_route and the like) were deliberately not built, because they would have moved reads of reconnecting, delay_active and active_delay_ns that other threads write; obs_output_force_stop(), obs_output_actual_stop() and obs_output_signal_stop()'s stop branch decide on single atomics and stay C. The reconnect policy stays C too.

    Follow-up issue: none filed, since nothing remains to port here. The upstream behaviours the PR characterizes but does not endorse (a negative restart count keeping the delay, a forced stop of an inactive output still calling info.stop) are listed in the PR description.

  5. moved this from In progress to Done in obs-rust Multiviewon Oct 27, 2026
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