Skip to content

rust: Port the output video size, conversion and capture checks in obs-output.c to obs-output #2067

Closed

Description

@rdoupe

Unit

Port the output video size, conversion and capture checks in libobs/obs-output.c.h to rust/obs-output, as a new module video_checks:

  • get_first_mixer: the lowest set bit of mixer_mask below MAX_AUDIO_MIXES, else 0;
  • obs_output_get_width2 / obs_output_get_height2: an encoded output asks its encoder, a raw output takes scaled_* or the video size;
  • video_valid, audio_valid and can_begin_data_capture: the flag and presence checks;
  • has_scaling and obs_output_get_video_conversion: the set conversion (a 0 width or height is filled from the output size), the scaled size, or none;
  • the delay-active and active gates in obs_output_can_begin_data_capture, before the join;
  • obs_output_get_congestion: the 0–1 clamp.

These stay C: obs_output_valid, the log_flag_* warnings, the pthread_join, obs_encoder_get_width/_height, video_output_get_* and info.get_congestion. C reads the fields and atomics and passes plain values.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-output-video-checks.c.h, as hidden functions over a plain struct.
  2. Characterization: test_output_video_checks_steps. It covers:
    • first_mixer for 0, single bits, several bits, and bits at or above MAX_AUDIO_MIXES;
    • each output flag × each presence bit;
    • the conversion cases;
    • congestion at -1, 0, 0.5, 1, 2, ±inf and NaN.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-output-video-checks group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C: exhaustive over flags and presence bits, plus proptests over u32 sizes, mixer masks and f32 bit patterns. Then a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane: test_raw_output_video_reset, test_scaled_mix_alpha, test_texture_encoder_raw_format, test_output_start_twice, test_output_failed_start_encoders, test_output_null_id and test_encoding_lag_rescale.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2067.

  2. added
    claimed
    on Oct 24, 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

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions