Repository navigation
obs-core: swap audio-info and video-statistics queries to safe Rust (Refs #5363, #5364) - #5365
Merged
Merged
Conversation
Safe Rust mirrors of every case of the unchanged
test_audio_info_queries.c (no core, NULL outputs, no audio output, the
copied rate and speakers, info2's inner info read before its own output
check, all four info2 fields with the helper's arguments, the int-to-u32
cast of a negative helper result), plus the full read order and a
proptest over any core, against todo!() cores for obs_get_audio_info and
obs_get_audio_info2.
soldr cargo test -p obs-data --test obs-tests-core -- audio_info_queries
test result: FAILED. 0 passed; 9 failed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
obs_get_audio_info and obs_get_audio_info2 now come from obs-core in
hybrid libobs. A NULL core answers false before any read. info checks its
output, then the core's audio output, then reads the rate and speakers
through the real audio_output_get_info(). info2 runs the info read into a
local first, then checks its own output and the audio output again, and
stores the rate, the speakers, fixed_buffer and
obs_core_setup_rules_buffer_ms(max_buffering_ticks, rate) cast straight to
uint32_t. Nothing is written on failure; the caller's struct is written
field by field.
The core layout stays in C behind private adapters
(obs-audio-info-queries-fields.c.h, also a shared Rust-static support
member). The original moves to libobs.ported-audio-info-queries for the C
reference; the unchanged test_audio_info_queries keeps testing it, and
test_get_audio and test_core_setup_rules_steps run the real library.
Tier 3 runs the original and the shim on one real-header core filled with
any byte, through one recording audio_output_get_info probe: result,
sentinel-filled output bytes, info call log, core bytes and the current
core pointer, plus the real-header layouts, with four shim mutants. The
audio-controls oracle's obs_get_audio_info stand-in is dropped: obs-core's
export answers false there without a current core.
soldr cargo test -p obs-data --test obs-tests-core -- audio_info_queries audio_controls
test result: ok. 38 passed; 0 failed
Mutation (fixed_buffering negated in the safe core): audio_info_queries_parity
2 passed; 2 failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) Safe Rust mirrors of every case of the unchanged test_video_stats_queries.c (zeroed stats, each query reading its own field, full-width boundaries, following the current core, values written through the private setters), each read taken under the stats mutex and the mutex free after every query, plus a proptest over any values with the FPS as any bit pattern, against todo!() cores for the five queries. soldr cargo test -p obs-data --test obs-tests-core -- video_stats_queries test result: FAILED. 0 passed; 6 failed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
obs_get_video_frame_time, obs_get_active_fps, obs_get_average_frame_time_ns, obs_get_total_frames and obs_get_lagged_frames now come from obs-core in hybrid libobs. Each is one call of its own obs_video_stats_* reader on the current core's video.stats (one lock, read and unlock, as #175 made it), returned unchanged: no combined snapshot and no no-core defaults. The stats layout and mutex stay in C behind private adapters (obs-video-stats-queries-fields.c.h, which call the header's static inline readers; also a shared Rust-static support member). The original moves to libobs.ported-video-stats-queries for the C reference; the unchanged test_video_stats_queries keeps testing it and test_video_stats_race the readers. Tier 3 runs the original and the shim on one real-header core with an initialized stats mutex: exact result bits (the FPS as any non-signaling binary64 pattern), the mutex free after every query, unchanged values and current core pointer, and the adapter's address, with four shim mutants. soldr cargo test -p obs-data --test obs-tests-core -- video_stats_queries audio_info_queries audio_controls test result: ok. 48 passed; 0 failed Mutation (total_frames reading the lagged count in the safe core): video_stats_queries 2 passed; 8 failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795185679,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":62,"stamp":"81f2b952313b636c392c808e77814cc0","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185679,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":62,"stamp":"cd7460a9e3c75a5be83e16bbc83c6faa","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185679,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":62,"stamp":"4721fb7c58fbe85e01f0c3d811565b9d","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185679,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":62,"stamp":"592af09ccba6ca0efadc81925d17ad79","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"general/all/client-lint","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"909be9b678c13d5229af36615b266a62","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185679,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":62,"stamp":"d868238ebafe228fbe42fc2cf9c6ddeb","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"68216eb392cb380ee7407fbccd6b7578","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"36a784ef548e3a667fa2a0f4fdb1bfc2","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"b6fc68281e73b664a8972d19af135d70","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"a3dcf17510cd2f94222e603780a8c2c0","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"8f08ba5500ef7bf217bfeb2bbfde3d76","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"0e5ae1ca4064fd8c33a3cf15a91440ab","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"417531904bbf6ab9cd704f77a53de586","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"204b9c8d54842debd8422b0b53ef0433","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"39c21d4aed5cf85e1776737630cb939c","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"38ae3959ca0a0d6d5c2a21bd9ac836c4","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"ae0d4ba62a5b334e1faef60bdb1c0fdf","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185616,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"6b41e9db32b71e2666732734d9ef5a67ce93c85acdfee75750d8a9fb757689f3","lane":"client-lint","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":133,"stamp":"739851458ec77d8799344917ab5a3c41","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Ci-Attestation: {"at":1795185947,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"4a10351870147ddc72d95c32caa53cf91a61c819e2c14de8158a4acf64569573","lane":"client-test-x86_64-unknown-linux-gnu","parents":["51a0d70969e159a3ac1b6ab2ea4f8087e6d6172a"],"secs":267,"stamp":"27c3a272fbdcc88adde6dbf5874aeef6","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08","v":1,"via":"run"} Client-Checks: {"checks":{"base":"63228662a57d498eca3e16c4c025b9f14a8e8edc","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/build/libobs.ported-audio-info-queries+.h.c","libobs/build/libobs.ported-video-stats-queries+.h.c","libobs/build/ported-source-sets/audio-info-queries.json","libobs/build/ported-source-sets/video-stats-queries.json","libobs/cmake/rust-exports.d/obs-core-audio_info_queries.txt","libobs/cmake/rust-exports.d/obs-core-video_stats_queries.txt","libobs/obs-audio-info-queries-fields.c.h","libobs/obs-video-stats-queries-fields.c.h","rust/README.md","rust/obs-c-oracle/oracle/audio_controls.c","rust/obs-c-oracle/oracle/audio_info_queries.c","rust/obs-c-oracle/oracle/video_stats_queries.c","rust/obs-core/src/audio_info_queries.rs","rust/obs-core/src/ffi/audio_info_queries.rs","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/ffi/video_stats_queries.rs","rust/obs-core/src/lib.rs","rust/obs-core/src/video_stats_queries.rs","rust/obs-core/tests/obs_core/audio_info_queries.rs","rust/obs-core/tests/obs_core/audio_info_queries_parity.rs","rust/obs-core/tests/obs_core/main.rs","rust/obs-core/tests/obs_core/video_stats_queries.rs","rust/obs-core/tests/obs_core/video_stats_queries_parity.rs","test/cmocka/audio-info-queries-link-support.c","test/cmocka/build/rust-static-support.json","test/cmocka/video-stats-queries-link-support.c"],"head":"25d44027f887e814aad33d78e1994d0cf8bbd93f","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504-GITv2.15.4\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"6e3d09658646b8f01c5803cc1f218fb21e3d25e030d408c63b11b9f41215663e","tree":"0501ce5aef36ca0bad8d028e091a04e78b3aea08"}}
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 20, 2026
This was referenced Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #5363, #5364
Two obs-core swaps of public queries extracted from
obs.c.hin #5191. One RED/GREEN commit pair per issue.Audio-info queries (#5363)
obs_get_audio_infoandobs_get_audio_info2are now Rust exports (obs-core::ffi::audio_info_queriesover the safeaudio_info_queriescore). A NULL core answers false before any read.obs_get_audio_infochecks its output, then the core's audio output, then reads rate and speakers through the realaudio_output_get_info().obs_get_audio_info2runs the info read into a local first, then checks its own output and the audio output again, and stores rate, speakers,fixed_bufferandobs_core_setup_rules_buffer_ms(max_buffering_ticks, rate)cast straight touint32_t. Nothing is written on failure; the caller's struct is written field by field.libobs/obs-audio-info-queries-fields.c.h, also a shared Rust-static support member). The original moves to the reference-only grouplibobs.ported-audio-info-queries+.h.c; exports inrust-exports.d/obs-core-audio_info_queries.txt.audio_info_queries.rsmirrors all eighttest_audio_info_queriescases plus the full read order and a proptest.audio_info_queries_parity.rsruns the original and the shim on one real-header core filled with any byte through one recordingaudio_output_get_infoprobe: result, sentinel-filled output bytes, info call log, core bytes, current core pointer, real-header layouts; four shim mutants.obs_get_audio_infostand-in is dropped: obs-core's export answers false there with no current core (the stand-in's answer).Video-statistics queries (#5364)
obs_get_video_frame_time,obs_get_active_fps,obs_get_average_frame_time_ns,obs_get_total_frames,obs_get_lagged_framesare now Rust exports. Each is one call of its ownobs_video_stats_*reader on the current core'svideo.stats(one lock/read/unlock, as bug: libobs: video stats (fps, frame time, total/lagged frames) raced between graphics and UI threads #175 made it): no combined snapshot, no no-core defaults.libobs/obs-video-stats-queries-fields.c.h, which call the header's static inline readers). The original moves tolibobs.ported-video-stats-queries+.h.c; exports inrust-exports.d/obs-core-video_stats_queries.txt.video_stats_queries.rsmirrors all fivetest_video_stats_queriescases over a mutex-guarded host (one locked read of its own field per query, mutex free after each) plus a proptest.video_stats_queries_parity.rscompares exact result bits (FPS as any non-signaling binary64), mutex free after every query, unchanged values and current core pointer, and the adapter's address; four shim mutants.The unchanged C tests keep testing the extracted C sources (they
#includethem with renamed symbols);test_get_audio,test_core_setup_rules_stepsandtest_video_stats_racecover the real library. No public headers, C tests, websocket code or workflows change. Tier 4 does not apply.Evidence
RED (stubs are
todo!()):GREEN:
Mutation checks of the safe cores (reverted):
get_audio_info2negatingfixed_buffering:audio_info_queries_parity2 passed; 2 failed.total_framesreading the lagged count:video_stats_queries2 passed; 8 failed (Tier 1 and parity)../lint: ok (after--fixreflowed one oracle prototype, folded into the GREEN commit).Tier 2 (one Docker build, full ctest on both builds, then the touched tests repeated):
Notes:
cargo testof the wholeobs-tests-corebinary (all tests in one process) failscanvas_valid_video_info_parityon its allocation-count check (bnum_allocs()moved by other tests in parallel). It fails the same way with this PR's modules skipped and passes alone; CI runs the binary under nextest, one process per test../pushattestedclient-testbut stopped atclient-swift(noswift-formaton this host), so this PR runs ordinary CI.🤖 Generated with Claude Code