Skip to content

rust: Port the source size query routing in obs-source.c to obs-source #2149

Closed

Description

@rdoupe

Unit

Port the source size query routing in libobs/obs-source.c.h to rust/obs-source, as a new module size_route. These decisions move:

  • get_async_width/get_async_height: the axis swap for a rotation that is not a multiple of 180. Since libobs: Keep an async rotation in 0-359 #2136, the stored rotation is in 0-359.
  • get_base_width/get_base_height, which pick one route:
    • a transition reports its actual size while it is enabled, and 0 otherwise;
    • a source with a size callback asks it (a filter, only while enabled);
    • a filter without one asks its target;
    • an async source reports its rotated frame size;
    • anything else reports 0.
  • get_recurse_width/get_recurse_height and obs_source_get_width/obs_source_get_height, which pick where to start: the first filter, the source itself, or (for a filter) itself.

These stay in C: data_valid, filter_mutex, the recursion into the target or the first filter, the get_width/get_height callbacks, and the fields each route reads.

Plan (one PR, separate commits)

  1. A behaviour-neutral move into libobs/obs-source-size.c.h, as hidden functions.
  2. Characterization in test_source_size_route_steps. It covers:
    • every route for every combination of type, callback, filter, enabled and async;
    • the swap for rotations 0, 90, 180, 270 and 45, and for raw long values (-90, 360, LONG_MIN, LONG_MAX) as the core would see them;
    • the entry point for a filter, an input with and without filters, a transition and a scene.
  3. RED, then GREEN: the safe Rust core plus shims, in a libobs.ported-source-size group. Exported symbols are unchanged.
  4. Tier 3 parity against the original C: exhaustive over the flags, plus a proptest over full c_long rotations. long is 32-bit on Windows, so both widths are tested. Also a deliberate-break check and port_comparison numbers.

These real-libobs tests must stay green on every lane:

  • test_async_rotation_normalize
  • test_slideshow_size
  • test_filter_color_space
  • test_scene_item_crop
  • test_scene_rotated_scale_filter
  • the transition size tests

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