Repository navigation
Description
Rust port, round 13 unit 2: the setup decisions in libobs/obs.c.h (the video and audio reset gates, the audio buffering tick rule, the command-line copy, the data path removal, the latest input type, the monitoring device checks and the frame counts), moved to Rust (rust/obs-core, new module core_setup_rules, next to video_plan, context_names and source_load).
Unit
libobs/obs.c.h → libobs/obs-core-setup-rules.c.h → rust/obs-core (core_setup_rules).
Phase and position
Phase 6 (core), the next slice of obs.c.h, after the registration size rules (#2860) in the same unity group (core+).
Scope
Rust takes over these decisions, each asked where the C makes it today, from the value C reads at that point:
obs_reset_video: the gates in order: no core (OBS_VIDEO_FAIL), video active, then outputs starting (OBS_VIDEO_CURRENTLY_ACTIVE), then the output size, then the base size (OBS_VIDEO_INVALID_PARAM; the size checks themselves are already Rust). The fps gate stays C;obs_reset_audio2: no core, then an active audio output (only asked when there is one); the buffering tick rule: amax_buffering_msof 0 gives 45 ticks, any other gives(ms * rate / 1000 + 1023) / 1024inuint32_t(the product wraps). The log value's divide by the rate stays C;obs_set_cmdline_args: set once (only while the storedargcis 0), the block size:argc + 1pointers, then each argument's length plus one;obs_remove_data_path: the first equal path is removed;obs_get_latest_input_type_id: a type wins when(int)versionis above the best so far (start -1), so the first of equal versions is kept;check_all_aoc_sources: theOBS_SOURCE_DO_NOT_SELF_MONITORgate;obs_set_audio_monitoring_device: a NULL or empty name or id, then no monitoring, refused; the same id returns true with no reset;obs_get_video_frame_counts: a mix counts when it is the main mix, or an encoder-only mix of the main mix's view, and has avideo.
C keeps every lock (monitoring_mutex, mixes_mutex), every call (obs_video_active, outputs_starting, audio_output_active, check_path, find_libobs_data_file, dstr_cmp, strcmp, strlen, obs_audio_monitoring_available, obs_reset_audio_monitoring, obs_enum_sources, video_output_get_*_frames), every allocation, copy and free, the core_video_release signal, the encoder unbind and rebind, the fps gate, every divide by a variable and every log message. Every read and call stays in its original place and under its original condition: a decision made from several reads is split into steps, so C asks after each read and stops where it stops today.
Dependencies and existing tests
- Depends on the video size checks (already Rust). No fix first.
- Existing real-libobs coverage:
test_obs_core_info_characterization(command line, data paths),test_encoding_lag_rescale(frame counts with a GPU rescale),test_scene_audio_actions(obs_reset_audio2), thetest_pulse_monitor_*tests (monitoring device),test_video_reset_fpsand many tests that callobs_reset_video. - No characterization of the steps themselves yet:
test_core_setup_rules_stepslands first, pinning each reset gate in order, the tick rule at 0 ms, 1 ms, an exact multiple of 1024 frames and a product aboveUINT32_MAX(characterized, not endorsed), the command line set twice and first withargc0 (characterized, not endorsed), a remove with two equal paths, the latest type with equal versions and a version aboveINT_MAX(never chosen: characterized, not endorsed), the monitoring device with NULL, empty, the same id and a new id, and the frame-count rule for each kind of mix.
Plan
The standard six commits, one PR:
- move to
libobs/obs-core-setup-rules.c.h(behaviour-neutral; the export sets stay identical on the C, hybrid and c-ref builds); - characterization test;
- Tier 1 RED;
- GREEN in
libobs.ported-core-setup-rules; - Tier 3 parity (exhaustive over the steps and booleans; proptest over
u32ms and rates, versions, and argument lengths), with a mutation check; - docs.
Notes
No intentional behaviour difference expected for any input libobs can pass. No SIMD, threading or per-OS code. The OBS_VIDEO_* codes and OBS_SOURCE_DO_NOT_SELF_MONITOR are copied into the rules header and _Static_asserted against the core headers in obs.c.h. obs_find_data_file stays C: it has no decision beyond the pointer test and check_path's own answer. The NULL oai return of obs_reset_audio2 (after the free) stays C as the guard of its dereference. R11-U1's functions (the video and audio info getters, the level setter, the object checks) and obs_queue_task are left alone.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 29, 2026
Claiming: #2878 (round 13 unit 2).
libobs/obs-core-setup-rules.c.h(behaviour-neutral).test_core_setup_rules_steps.todo!()stubs.libobs.ported-core-setup-rules.One PR; a draft opens with the RED commit today. #2877 edits three of these functions' lines in
obs.c.h(casts only), so whichever lands second rebases.libobs: Move the core setup rules
test: Characterize the core setup rules
obs-core: Test the core_setup_rules port
obs-core: Port the core setup rules
obs-core: Check core_setup_rules against the C
docs: Record the core_setup_rules port
test: Characterize the data file search order
obs-core: Test the data file search rule
libobs: Sort the core setup rules symbol lists
obs-core: Port the data file search rule
obs-core: Check the data file search against C
docs: Record the data file search rule
obs-core: Port the core setup rules (obs-rust#2881)