Skip to content

obs-core: Port the source load migration and value rules - #2157

Merged
zackees merged 6 commits into
obs-rust:masterfrom
rdoupe:port/source-load
Oct 24, 2026
Merged

zackees merged 6 commits into
obs-rust:masterfrom
rdoupe:port/source-load

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2143

What and why

Ports the source load migration and the value rules of obs_load_source_type() (libobs/obs.c.h) to rust/obs-core, as a new module source_load. These are the decisions obs_load_source() and obs_load_private_source() make for every source and filter in a scene collection:

Every obs_data_*() call and setter stays in C, in the same order and the same number of calls; C passes the values it read. The source creation, the canvas lookup, the private settings and the filter recursion stay in C too.

Six commits:

  1. Move (behaviour-neutral): the decisions go to libobs/obs-source-load.c.h as six functions on plain values, declared in the new obs-source-load.h without EXPORT, so they are hidden:

    • obs_source_load_prev_ver(stored): the saved int64 as the uint32_t the source is created with;
    • obs_source_load_volume(volume), obs_source_load_balance(balance), obs_source_load_delay(delay) and obs_source_load_deinterlace_mode(mode): each rule and its comment, moved as they were;
    • obs_source_load_monitoring_migration(prev_ver, caps, monitoring_type) returns a struct: whether to set the mixers and to what, and whether to store "monitoring_enabled" and its value. It takes the saved int64 type and reads it as an int, as the (int) cast did.

    obs_load_source_type() calls obs_source_set_audio_mixers() and obs_data_set_bool() only when the plan says so, as the two ifs did. The constants are copied into the header (so it needs only stdbool.h and stdint.h), and _Static_asserts in obs.c.h check each against obs-config.h, obs-source.h, obs.h and MAX_AUDIO_MIXES.

    This was checked against the original code. A scratch harness (not committed) compiles origin/master's obs_load_source_type() verbatim next to the moved one, on stub obs_data and source calls that record every call with its arguments (doubles and floats by bit pattern, so NaN payloads and -0 count):

    • 10,000,000 loads under ASan and UBSan, at -O0 and -O2, plus 3,000,000 more on the final tree;
    • saved values from the edges (NaN payloads of both signs, ±inf, -0, FLT_MAX and its neighbours, subnormals, the int and int64 ends, versions around 23.2.2 and 33.0.0 and those plus 2^32), random bit patterns, keys present or missing, caps with and without the cap, scene, group and filter types, and filters through the recursion;
    • 859,000,000 recorded calls, equal in order and value.

    Fourteen deliberately broken moves were tried. Thirteen fail the harness; the fourteenth, a balance bound of >= 1.0, is equivalent.

    git log -L on obs_load_source_type shows libobs: Saturate push-to-talk stop times and clamp the audio balance #2058, libobs: Disable an out-of-range deinterlace mode instead of drawing nothing #2120 and libobs: Keep source volumes finite and non-negative #2128 as the fork's changes. Each rule moved as it is, except that volume = INFINITY became volume = (double)INFINITY (the same value): INFINITY is a float, and the C oracle builds with -Wdouble-promotion -Werror for macOS.

  2. Characterization: test_source_load_migration_steps, 19 cases. It compiles the moved file (ASan and UBSan) and calls only the six functions. It pins:

    • versions just below, at and above 23.2.2 and 33.0.0;
    • prev_ver 0, UINT32_MAX, and int64s above it;
    • each monitoring type and values outside the enum, with and without the cap, plus a 12 × 8 × 11 cross;
    • every value rule at its edges, including NaN, ±inf, -0, ties to even and subnormals.

    The test is in the core suite of the test graph and links libm except on MSVC.

  3. RED: Tier 1 in the crate against todo!(): the 19 C cases ported 1:1, and 6 edge proptests that check each function against its rule written out independently. The in-range floats are checked against a nearest-float search over the float bits, not against a cast.

  4. GREEN: the safe core and six #[no_mangle] shims, in a new libobs.ported-source-load group. Its PCH is float.h, limits.h, math.h and the new header. This commit updates the three export lists, source-sets.json, the unity lists and ci/test_ported_sources.py (every host), each in sorted place.

  5. Tier 3: a C oracle of the unchanged file, parity, the regression files, the mutation check, and one more Tier 1 edge test (semantic_version()).

  6. Docs: the README rows, the crate's description, lib.rs, and a port_comparison bench file.

The core denies clippy's arithmetic, indexing, unwrap, expect, panic, todo, unimplemented and unreachable lints. It keeps no state and takes no lock. Every input comes from a scene collection (any JSON number), and nothing in the core can panic on any input.

  • The C's comparisons are kept. NaN passes through both float rules, and the setters map it (bug: libobs: push-to-talk delays can wrap and the audio balance isn't range-checked #2051, bug: libobs: a NaN or negative source volume isn't rejected and breaks every mix the source is in #2108). -0.0 is not below 0, so it stays -0.0. A value past FLT_MAX is infinity, even where float rounding would give FLT_MAX. The balance uses f64::clamp(0.0, 1.0), which is the same two comparisons.

  • Kept, characterized, not endorsed:

    • a saved prev_ver past 32 bits keeps its low 32 bits, so 2^32 + 23.2.1 reads as 23.2.1 and migrates, and -1 reads as UINT32_MAX;
    • the saved monitoring type is read as an int, so 2^32 is none and 2^32 + 1 is monitor-only;
    • -0.0 stays -0.0 for the volume and the balance.
  • Intentional differences: none. Tier 3 compares a NaN only as a NaN, not its payload or sign: Rust leaves those unspecified for an f64 to f32 cast, and both setters map every NaN alike.

  • No _rust variant. test_source_load_migration_steps_rust was wired against libobs_rust-static and fails to link with 404 undefined references. The shims' archive member (an obs_core codegen unit) also holds the views and the other obs-core shims, which pull in obs-util and obs-media-io members that need libobs (blog, bcrash, the graphics context, GIO). The target was removed, and its tests.d file says why. Tier 3 compares the shims with the C instead, and the real-libobs tests see the swap through the hybrid.

  • Tier 3 compares the shim, the C and the core on every input: the plan field by field, the integers, and the floats bit for bit.

    • The migration runs exhaustively over each of the 32 caps bits alone, none, all, and all but the cap, × 30 types × 80 versions (84,000 combinations, every branch reached).
    • It also runs every major.minor version (65,536) with five patches, with and without the cap, for each type (2,621,440 calls).
    • The value rules run over their edges, ten NaN classes, and every 4093rd f32 bit pattern widened with its neighbours (3,148,035 doubles).
    • Proptests (8192 cases each) run over u32 and i64 versions, any caps and types, and f64 and f32 bit patterns.
    • The parity module passed 10 runs in a row with fresh seeds.
  • Mutation check (not committed): 41 mutants, each run against Tier 1 (26 tests) and Tier 3 (13).

    Area Mutants Tier 1 kills Tier 3 kills Survivors
    prev_ver (saturating) 1 1 1 0
    volume (each bound, the infinity, <=/>=, NaN mapped) 6 6 6 0
    balance (-0.0 lower bound, 1 - ε, max/min, NaN mapped, bound -1) 5 4 4 1, equivalent: clamped to 1 - f64::EPSILON, which rounds to 1.0f
    delays (|d|, wrap) 2 2 2 0
    deinterlace mode (low bits, out of range as 1, saturating) 3 3 3 0
    migration (each bound <=, or/and, type not migrated, five mixers, negative types, type read four other ways, any cap, never stores, both bounds moved, cap bit 10) 14 14 14 0
    semantic_version() (patch's high byte dropped) 1 1 0 0
    shims (arguments swapped, functions crossed, |delay|, mode truncated first, fields swapped, struct reordered, negative version as 0, mixers forced) 9 0 9 0

    Tier 1 does not reach the shims, and Tier 3 kills every shim mutant. The semantic_version() mutant is killed by Tier 1 only, because Tier 3 builds its versions with the same helper.

  • Exported symbols: 1766 on the C backend, the hybrid and libobs-c-reference, with identical sets, unchanged from master. This was checked on the move and on f64aa1a46. The six functions are local (t) in all three. In the hybrid they come from the Rust archive: no C object of the group is in the hybrid libobs.

  • Performance (port_comparison, x86_64 Linux, GCC, release, a loaded host; median per 1024 loads through all six functions): Rust 8.92 µs, C 14.34 µs. These run once per source or filter when a scene collection loads, never per frame. The full port_comparison run stops earlier at the existing bmem/count fixture check. These numbers come from a run with only this file's benchmarks enabled, and that edit was not committed.

  • Coverage gap: no real-libobs test loads a source with prev_ver or monitoring settings. The harness covers the moved caller, and the characterization and Tier 3 cover the decisions; a real-libobs migration test would be a separate change.

  • Overlap: no open PR touches libobs/obs.c.h. libobs: Move the hotkey binding press count into obs-hotkey-binding-press.c #1837 (draft) touches the libobs.core group file, but not the lines this changes.

  • No user-visible change, so no docs/features.md line.

RED → GREEN

  • RED commit: 9f415352a. soldr cargo test -p obs-data --test obs-tests-core -- obs_core::source_load:: fails 24 of 25 with "not yet implemented"; steps_constants, which reads only the constants, passes.
  • GREEN: 0d0167227, Tier 1 25/25. On f64aa1a46 (the head): Tier 1 26/26 and Tier 3 13/13, and test_source_load_migration_steps 19/19. The source load tests (test_source_audio_ranges, test_source_volume_mix, test_deinterlace_mode_load, test_source_load_migration_steps, the scene and filter loads, the monitoring_type tests) pass 13/13 on the C backend and 14/14 against the hybrid libobs and libobs-c-reference. The full ctest passes 448/448 on the C backend and 462/462 against the hybrid libobs, with 0 skipped, test_deinterlace_2x_field_order included (private Xvfb, fresh HOME). ci/local_gate.py --test-diff origin/master runs 3401 Rust tests, all passing (4 skipped by the default filter); --lane lint and --lane cross pass. All on f64aa1a46.
  • Real app (UI, protocol output or logging changes): not applicable, no UI, protocol or log change.

Checklist

  • Base is master (or the description starts with a Stacked: note)
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits (N/A for docs-only; a focused CI fix may push RED and GREEN together)
  • User-visible change: its line in docs/features.md is added or updated (not applicable: no user-visible change)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): built with scripting ON (PR CI builds no OBS app: run gh workflow run ci.yml --ref <branch> for the full builds) and cross-checked with clang and MSVC
  • Intentional differences from C listed in the parity test header and rust/README.md (ports)

@rdoupe
rdoupe requested a review from zackees as a code owner October 24, 2026 13:41
@zackees
zackees added this pull request to the merge queue Oct 24, 2026
@zackees

zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member

Coordinator: this shows UNMERGEABLE in the queue because it conflicts with #2159, which is ahead of it, in rust/obs-c-oracle/benches/port_comparison.rs. It merges cleanly with master. I'll rebase it after #2159 lands.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 24, 2026
…e-load.c

Behaviour-neutral extraction before the Rust port. The pure decisions of
obs_load_source_type() move to libobs/obs-source-load.c.h, as six functions
on plain values declared in the new libobs/obs-source-load.h without EXPORT
(hidden, as -fvisibility=hidden keeps them):

- obs_source_load_prev_ver(stored): the saved "prev_ver" int64 as the
  uint32_t the source is created with (its low 32 bits, as the cast did);
- obs_source_load_volume(volume): obs-rust#2128's rule, 0 when negative, INFINITY
  past FLT_MAX, then the float cast;
- obs_source_load_balance(balance): obs-rust#2058's rule, 0 to 1, then the cast;
- obs_source_load_delay(delay): obs-rust#2058's rule, a negative push-to-mute or
  push-to-talk delay is none;
- obs_source_load_deinterlace_mode(mode): obs-rust#2120's rule, a mode past the int
  range is OBS_DEINTERLACE_MODE_DISABLE;
- obs_source_load_monitoring_migration(prev_ver, caps, monitoring_type):
  before 23.2.2 a source with OBS_SOURCE_MONITOR_BY_DEFAULT becomes
  monitor-only and gets all six mixers; before 33.0.0 "monitoring_enabled"
  is stored as the (migrated) type not being none. It takes the saved int64
  type and reads it as an int, as the (int) cast did. The answer is a
  struct: whether to set the mixers and to what, and whether to store
  "monitoring_enabled" and its value.

obs.c.h keeps every obs_data_*() call and setter, in the same order and the
same number of calls: it reads each value, passes it in, and hands the
answer to the setter (obs_source_set_audio_mixers() and obs_data_set_bool()
only when the plan says so, as the two ifs did). The source creation, the
canvas lookup, the private settings and the filter recursion stay as they
were.

The constants are copied into the header (MAKE_SEMANTIC_VERSION(23, 2, 2)
and (33, 0, 0), OBS_SOURCE_MONITOR_BY_DEFAULT, the two monitoring types,
the six-mixer mask and OBS_DEINTERLACE_MODE_DISABLE), so it needs only
stdbool.h and stdint.h; obs.c.h checks each against obs-config.h,
obs-source.h, obs.h and MAX_AUDIO_MIXES with _Static_assert. The new file
joins libobs.core, before obs.c.h, with libobs.pch.h, which includes the new
header; source-sets.json lists it. docs/rust-port/naming.md maps it to
rust/obs-core. The exported symbol set is unchanged (1766); the six
functions are local.

Checked in a scratch harness (not committed) that compiles origin/master's
obs_load_source_type() verbatim next to this one and the moved file, on stub
obs_data and source calls that record every call with its arguments
(doubles and floats by bit pattern, so NaN payloads and -0 count): 10,000,000
loads under ASan and UBSan, at -O0 and -O2, with saved values drawn from the
edges (NaN payloads of both signs, +-inf, -0, FLT_MAX and its neighbours,
subnormals, the int and int64 ends, versions at and around 23.2.2 and 33.0.0
and those plus 2^32), random bit patterns, keys present or missing, caps with
and without the cap, scene, group and filter types, and filters loaded
through the recursion: 859,000,000 recorded calls, equal in order and value.
Deliberately broken moves (each comparison of the volume, balance, delay and
deinterlace rules, the prev_ver cast, both version bounds, the migrated type,
the mixer mask, the type cast) all fail it, except a balance bound of
>= 1.0, which is equivalent.

git log -L on obs_load_source_type shows obs-rust#2058 (balance and delays), obs-rust#2120
(deinterlace mode) and obs-rust#2128 (volume) as the fork's changes; each rule and
its comment moves as it is; the volume's
"volume = INFINITY" becomes "volume = (double)INFINITY" (the same value),
since INFINITY is a float and the C oracle builds with -Wdouble-promotion
-Werror.

Refs obs-rust#2143
test_source_load_migration_steps compiles libobs/obs-source-load.c.h into
itself (ASan and UBSan) and calls only its six hidden functions, through
obs-source-load.h. 19 cases pin:

- the header's constants: 0x17020002 (23.2.2), 0x21000000 (33.0.0), the
  cap bit 0x800, the two monitoring types, the mixer mask 0x3F and the
  disabled deinterlace mode;
- prev_ver: 0, 1, INT32_MAX and the step past it, and UINT32_MAX as
  themselves; characterized, not endorsed: an int64 past UINT32_MAX keeps
  its low 32 bits (2^32 + 23.2.1 reads as 23.2.1 and migrates, 2^32 as 0),
  and a negative one wraps (-1 is UINT32_MAX);
- the monitoring migration at, just below and just above 23.2.2 and 33.0.0
  (and 22.0.3, 23.2.0, 23.2.1, 32.255.65535 and 34.0.0): below 23.2.2 a
  source with the cap is monitor-only with all six mixers whatever its type;
  below 33.0.0 "monitoring_enabled" is stored as the type not being none; at
  and past 33.0.0 nothing is stored, for every type and cap;
- prev_ver 0 (never saved) migrating both ways and UINT32_MAX neither;
- each monitoring type and values outside the enum (3, -1, INT_MAX, INT_MIN)
  with no cap, the cap, every other bit and every bit; characterized, not
  endorsed: the saved int64 type is read as an int, so 2^32 is none and
  2^32 + 1 monitor-only;
- a cross of 12 versions, 8 cap sets and 11 types against the rule written
  out;
- the volume: in range as the nearest float (ties to even, subnormals, a
  double below half the smallest subnormal as 0), negative values and -inf
  as 0, FLT_MAX and below as themselves, anything past FLT_MAX as INFINITY
  (characterized, not endorsed: also a value float rounding would take back
  to FLT_MAX), NaN of either sign and any payload as NaN; characterized, not
  endorsed: -0.0 stays -0.0f;
- the balance: 0 to 1 as the nearest float (just under 1 rounds to 1), past
  1 and +inf as 1, negative and -inf as 0, NaN as NaN, -0.0 as -0.0f
  (characterized, not endorsed);
- the delays: 0 up to INT64_MAX as themselves, -1 down to INT64_MIN as 0;
- the deinterlace mode: every enum value, 9, -1, INT_MAX and INT_MIN as
  themselves (the setter disables a mode it does not know, obs-rust#2120), and past
  the int range (INT_MAX + 1, INT_MIN - 1, UINT32_MAX, 2^32 + 1, 2^32 + 5,
  the int64 ends) as disabled, not as the low 32 bits.

The test is in the core suite of the test graph and links libm except on
MSVC. test_source_audio_ranges, test_source_volume_mix and
test_deinterlace_mode_load cover the caller through the real libobs.

Refs obs-rust#2143
The safe API of obs_core::source_load, with todo!() bodies: the constants
(MONITOR_ONLY_BEFORE and MONITORING_ENABLED_BEFORE through
semantic_version(), MONITOR_BY_DEFAULT, the two monitoring types,
ALL_MIXERS, DEINTERLACE_DISABLE), MonitoringPlan (struct
obs_source_load_monitoring), and prev_ver(), volume(), balance(), delay(),
deinterlace_mode() and monitoring_migration().

tests/obs_core/source_load.rs ports test_source_load_migration_steps.c 1:1:
its 19 cases as steps_*, under the same names, in the same order, with the
same values, the "characterized, not endorsed" ones included. Six new
edge_* proptests (4096 cases each) check each function against its rule
written out independently:
- prev_ver() as the low 32 bits of any int64;
- the migration over any u32 version (weighted to 23.2.2 and 33.0.0 +-2 and
  the ends), any caps with and without the cap bit, and any int64 type;
- volume() and balance() over f64 bit patterns (every NaN payload,
  subnormals, both zeros), f32 bit patterns widened, and the 64 doubles
  either side of FLT_MAX, 1 and 0; the in-range result is checked against
  the nearest float found by a search over the float bits, ties to even,
  not against a cast;
- delay() and deinterlace_mode() over any int64, weighted to the int and
  int64 ends.

soldr cargo test -p obs-data --test obs-tests-core -- obs_core::source_load::
fails 24 of 25 with "not yet implemented"; steps_constants, which reads
only the constants, passes.

Refs obs-rust#2143
Ports libobs/obs-source-load.c.h, the source load migration and value rules
of obs_load_source_type(), to the source_load module of rust/obs-core.
obs.c.h stays C around it: every obs_data_*() call and setter, in the same
order and the same number of calls, the source creation, the canvas lookup,
the private settings and the filter recursion. The hybrid libobs drops the
C file and links the Rust shims in its place.

Safe core (src/source_load.rs):
- prev_ver(): the low 32 bits of the saved int64, as the C's cast;
- volume(): 0 when below 0, infinity when above f32::MAX, else the value;
  then as f32 (round to nearest, ties to even, as the C's cast). The
  comparisons are the C's, so NaN passes both and stays NaN, and -0.0 stays
  -0.0;
- balance(): f64::clamp(0.0, 1.0), which is the C's two comparisons
  (NaN and -0.0 pass through), then as f32;
- delay(): u64::try_from, 0 when negative;
- deinterlace_mode(): i32::try_from, DEINTERLACE_DISABLE when past the int
  range;
- monitoring_migration(): the saved type read as its low 32 bits; before
  23.2.2 with MONITOR_BY_DEFAULT, monitor-only with ALL_MIXERS; before
  33.0.0, store enabled as the type not being none.
The module denies clippy's arithmetic, indexing, unwrap, expect, panic,
todo, unimplemented and unreachable lints, keeps no state and takes no
lock.

Shims (src/ffi/source_load.rs): the six functions keep the C signatures.
struct obs_source_load_monitoring is mirrored #[repr(C)] and returned by
value. No pointer crosses. No intentional differences.

C side: the file leaves libobs.core for its own group,
libobs.ported-source-load (LIBOBS_PORTED_SOURCES), whose PCH is float.h,
limits.h, math.h and obs-source-load.h; libobs.pch.h keeps the header for
obs.c. The functions are not EXPORT, so the shims are hidden:
rust-hidden.txt, the local: list of rust-exports.map and
rust-unexports-macos.txt. libobs-rust already links the crate's ffi. The
exported symbol sets are unchanged and equal: 1766 on the C backend, the
hybrid and libobs-c-reference; the six functions are local in all three,
and the hybrid's come from the Rust archive (no C object of the group in
the hybrid libobs). ci/test_ported_sources.py checks the group on every
host.

test_source_load_migration_steps still compiles the C file into itself,
unchanged. It has no _rust variant: linking it against libobs_rust-static
was tried and fails with 404 undefined references, because the shims'
archive member (an obs_core codegen unit) also holds the views and the other
obs-core shims, which pull in obs-util and obs-media-io members that need
libobs (blog, bcrash, the graphics context, GIO). The real-libobs tests
(test_source_audio_ranges, test_source_volume_mix,
test_deinterlace_mode_load and the scene collection loads) see the swap
through the hybrid.

Tier 1 obs_core::source_load passes 25/25.

Refs obs-rust#2143
rust/obs-c-oracle/oracle/source_load.c compiles the unchanged
libobs/obs-source-load.c.h with its six functions renamed oracle_*, plus
its constants and the layout of struct obs_source_load_monitoring.
tests/obs_core/source_load_parity.rs (13 tests) runs the shim, the C and
the safe core on every input and compares the results exactly: the plan
field by field, the version, delay and mode as integers, the volume and
balance bit for bit (so -0.0 is not 0.0). A NaN must come out as a NaN on
every side; its payload and sign are not compared, since Rust leaves them
unspecified for an f64 to f32 cast and both setters map every NaN alike.

- the 7 constants, and the size, alignment and every offset of the struct,
  against the C;
- the migration exhaustively over the cap (each of the 32 caps bits alone,
  none, all, all but the cap) x 30 types (-3 to 5, the int and int64 ends,
  2^32 +-2 either way) x 80 versions (both bounds +-3, every power of two
  and one below, the ends): 84,000 combinations, every branch reached;
  every major.minor version (65,536) with patches 0 to 3 and 0xffff, with
  and without the cap, for each monitoring type and 3 (2,621,440 calls);
  saved int64 versions (those, +-2^32 and negated) through prev_ver() into
  the migration;
- the value rules over their edges (the 64 doubles either side of 0, 1,
  -1 and +-FLT_MAX, subnormals, the half-ulp and tie cases), ten NaN
  classes, every int64 within 64 of 0, the int ends, UINT32_MAX, +-2^32 and
  the int64 ends; and every 4093rd f32 bit pattern widened with its double
  neighbours (3,148,035 doubles, each through volume() and balance());
- proptests (8192 cases each) over any u32 version, caps and int64 type;
  versions within 2^24 of each bound; any int64 version through prev_ver();
  f64 bit patterns; f32 bit patterns widened; and any int64 value.

Tier 1 gains edge_semantic_version(): semantic_version() against
MAKE_SEMANTIC_VERSION() written out for every major, minor and 16-bit
patch.

The parity module passed 10 runs in a row with fresh seeds.
test_source_load_migration_steps passed 19/19 under ASan and UBSan. The
committed regression files hold the seeds proptest saved while mutants
failed; all pass on the port.

Mutation check (not committed): 41 mutants, 32 in the core and 9 in the
shims, each run against Tier 1 (26 tests) and Tier 3 (13). 40 fail; the one
that survives is equivalent (the balance clamped to 1 - f64::EPSILON, which
rounds to 1.0f). Tier 1 does not reach the shims; Tier 3 kills every shim
mutant (the arguments swapped, the struct's fields reordered or swapped, the
volume and balance crossed, the delay, mode and version pre-mangled, the
mixers forced). A semantic_version() that drops the patch's high byte is
killed by Tier 1 only (Tier 3 builds its versions with the same helper).

Refs obs-rust#2143
rust/README.md gets the obs-core crate row and a port row for
libobs/obs-source-load.c.h: the six hidden functions, what
obs_load_source_type() keeps (every obs_data_*() call and setter in the same
order and number, the source creation, the canvas lookup, the filter
recursion), the C's comparisons kept (NaN through, -0.0 kept, infinity past
FLT_MAX), the 32-bit truncations characterized and not endorsed, why there
is no _rust variant, and what Tier 3 covers. The crate's description and
lib.rs list the module.

port_comparison gets its own bench file, port_comparison/source_load.rs:
1024 loads' worth of saved values (versions either side of 23.2.2 and
33.0.0, with and without the cap, every monitoring type, volumes and
balances in and out of range with a NaN now and then, delays and modes
either side of their ranges) through all six functions, folded into a
checksum both sides must match. On this host (x86_64 Linux, release): Rust
8.92 us, C 14.34 us per 1024 loads; obs_load_source_type() makes these
calls once per source or filter when a scene collection loads, none per
frame.

Fixes obs-rust#2143
@zackees
zackees enabled auto-merge October 24, 2026 14:43
@zackees

zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member

Coordinator: rebased after #2159 landed. #2159 turned the bench calls in port_comparison.rs into a modules![] list that checks for leaks, so I added this PR's module to that list. cargo check -p obs-c-oracle --benches passes. If this module's bench fixtures leave bmalloc allocations live, the new leak assert names the module. Auto-merge set.

@zackees
zackees added this pull request to the merge queue Oct 24, 2026
Merged via the queue into obs-rust:master with commit de8f030 Oct 24, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

rust: Port the source load migration in obs.c to obs-core

2 participants