Skip to content

libobs: extract core audio-info and video-statistics queries verbatim (Refs #5169, #5171) - #5191

Merged
rdoupe merged 4 commits into
masterfrom
test/5169-5171-audio-info-video-stats
Nov 19, 2026
Merged

rdoupe merged 4 commits into
masterfrom
test/5169-5171-audio-info-video-stats

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #5169, #5171

Moves seven public core getters out of libobs/obs.c.h, ready for their later Rust swap:

Both files join the existing core unity group (libobs/build/libobs.core+.h.c, sorted). The bodies are byte-for-byte unchanged (diffed against origin/master's obs.c.h), so nothing about their behavior changes. Both issues are small getter extractions out of the same file and the same unity group, so they land in one PR with a RED then GREEN commit pair each.

Commits

  1. RED ab11f92 test: characterize core audio-info queries: new cmocka test test_audio_info_queries.
  2. GREEN 91e94e8 libobs: extract core audio-info queries verbatim.
  3. RED 72ad69a test: characterize core video-statistics queries: new cmocka test test_video_stats_queries.
  4. GREEN 048a34809 libobs: extract core video-statistics queries verbatim.

What the tests pin

obs is hidden in libobs, so each test includes the exact extracted file under renamed entry points against a stack struct obs_core.

Audio info (audio_output_get_info and obs_core_setup_rules_buffer_ms routed through recording probes; the milliseconds arithmetic stays pinned by the existing test_core_setup_rules_ms_steps):

  • No core: both getters return false, write nothing and call nothing (the bug: libobs: obs_reset_audio2 and obs_get_audio_info2 read through a null core (UBSan) #3363 / bug: libobs: level getters and texture checks crash with no core #2566 guard).
  • obs_get_audio_info: NULL output or no audio->audio returns false with no call and no write; on success exactly one info read, rate and speakers copied, across four rate/layout pairs including 0 and UINT32_MAX.
  • obs_get_audio_info2: reads the info into its local before checking the extended output, so a NULL oai2 still makes one audio_output_get_info call; no audio->audio returns false with no call. On success rate, speakers, fixed_buffering (both states) and max_buffering_ms are copied, the helper gets the core's max_buffering_ticks and the copied rate, in the order info read then helper, and its int result is cast straight to uint32_t (-1 reads back as UINT32_MAX).

Video statistics (real obs_video_stats with its real mutex):

  • Each of the five queries returns its own field: all five values distinct, zero on a fresh core, and full-width boundaries (UINT64_MAX, UINT32_MAX, 1e308) passed through without narrowing.
  • The queries follow the obs pointer: switching between two cores switches every value.
  • Values written through the private setters (set_frame_time, set_timing, add_frames twice) are the ones read back.
  • The stats mutex is free again after every query (trylock from another thread).

A NULL core is outside the video getters' C contract and is not exercised. Existing coverage stays unchanged (test_no_core_getters, test_obs_core_info_characterization, test_core_setup_rules_steps, test_core_setup_rules_ms_steps). Existing C tests, public headers, Rust code, workflows and plugins/obs-websocket are not touched. No user-visible change, so the features ledger is unchanged. Tier 1, Tier 3 and the real-adapter linkage belong to the Rust swaps that follow. Tier 4 doesn't apply.

Evidence

RED: compiling each test from a git archive export of its RED commit, in the Tier 2 image (obs-rust-linux-validate), stops at the missing seam. The GREEN export compiles cleanly (cc -fsyntax-only -Werror, same include paths and defines as the Tier 2 build's compile_commands.json):

== ab11f9240 (RED) test_audio_info_queries
test/cmocka/test_audio_info_queries.c:16:2: error: #error "audio-info query extraction seam is missing"
exit=1
== 91e94e828 (GREEN) test_audio_info_queries
exit=0
== 72ad69adb (RED) test_video_stats_queries
test/cmocka/test_video_stats_queries.c:17:2: error: #error "video-statistics query extraction seam is missing"
exit=1
== 048a34809 (GREEN) test_video_stats_queries
exit=0

GREEN: full Tier 2 against both libraries, then 25 repeats of each new test:

$ OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 25 --tests 'test_audio_info_queries|test_video_stats_queries'
== libobs exported symbols, C vs Rust
IDENTICAL (1769 symbols)
== [OFF] tests load /build/tree/libobs-c-reference/libobs.so.30
100% tests passed, 0 tests failed out of 1015
== [OFF] ctest --repeat until-fail:25 -R test_audio_info_queries|test_video_stats_queries   -> 2/2 Passed
== [ON] tests load /build/tree/libobs/libobs.so.30
100% tests passed, 0 tests failed out of 1015
== [ON] ctest --repeat until-fail:25 -R test_audio_info_queries|test_video_stats_queries    -> 2/2 Passed

The tests never call skip(). Running the binaries directly against each library shows every case ran:

== libobs-c-reference
[  PASSED  ] 8 test(s).      test_audio_info_queries
[  PASSED  ] 5 test(s).      test_video_stats_queries
== libobs
[  PASSED  ] 8 test(s).
[  PASSED  ] 5 test(s).

Mutation check, each test rebuilt in the Tier 2 image against a mutated copy of its extracted file:

obs_get_total_frames returns the lagged count            [  FAILED  ] each_query_reads_its_field, boundary_values, reads_current_core, reads_setter_writes
info2 checks oai2 before reading the info               [  FAILED  ] info2_null_output_still_reads_info
info copies a fixed SPEAKERS_STEREO                     [  FAILED  ] info_copies_rate_and_speakers, info2_copies_all_fields

./lint passes.

🤖 Generated with Claude Code

@rdoupe
rdoupe requested a review from zackees as a code owner November 19, 2026 03:23
@rdoupe rdoupe changed the title libobs: extract core video-statistics queries verbatim (Refs #5171) libobs: extract core audio-info and video-statistics queries verbatim (Refs #5169, #5171) Nov 19, 2026
@rdoupe
rdoupe force-pushed the test/5169-5171-audio-info-video-stats branch from a6b2371 to a6f174c Compare November 19, 2026 04:38
@rdoupe
rdoupe enabled auto-merge November 19, 2026 04:39
@rdoupe
rdoupe added this pull request to the merge queue Nov 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 19, 2026
@rdoupe
rdoupe force-pushed the test/5169-5171-audio-info-video-stats branch from a6f174c to 0c19d90 Compare November 19, 2026 06:22
@rdoupe
rdoupe enabled auto-merge November 19, 2026 06:22
rdoupe and others added 3 commits November 19, 2026 02:04
RED: the new focused test fails to build with "audio-info query
extraction seam is missing" until the bodies move out of obs.c.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GREEN: move obs_get_audio_info and obs_get_audio_info2 unchanged into
libobs/obs-audio-info-queries.c.h in the core unity group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RED: the new focused test fails to build with "video-statistics query
extraction seam is missing" until the bodies move out of obs.c.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GREEN: move obs_get_video_frame_time, obs_get_active_fps,
obs_get_average_frame_time_ns, obs_get_total_frames and
obs_get_lagged_frames unchanged into libobs/obs-video-stats-queries.c.h
in the core unity group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Ci-Attestation: {"at":1795073103,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":58,"stamp":"bdf48f85ca7ad91666656a6ca9e40b36","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073103,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":58,"stamp":"e916e97096a6fe41480070f6b995ac2e","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073103,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":58,"stamp":"76b8f40ba8613120efca9ff70ff1264e","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073103,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":58,"stamp":"0a9e1db55f5903d5ed8ad66de98c5a4d","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"general/all/client-lint","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"ed56ca5de0269a24338dee85091ce7c2","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073103,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":58,"stamp":"079adb0f1a11c50a81221d3c1b4b423d","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"b7f2cebef4addfdfda56df2c40486c82","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"c025a4579e7e6b893cf80754f8fdde3d","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"b635e8a04c26358123439562a6fd63ca","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"0c861ae10d9ab800cea6284482eaba43","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"c7a69109cdc8b9c9cc0250f7a2f9d89f","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"4a7e6f6fe37d13f389ea5406d5a16dc3","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"0fdeba4f7ae562c097b42d28f8639ddd","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"5f29838584ff35a764cb1668522fd707","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"5a3c7d11002c04ec3d2afa9f9ddedd0f","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"c3c7247acc3c4a74c6eac68dc8932f25","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"4c5687c51b507530eafb53562277859e","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073044,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"fe80deb2393cd35a8eb884d1f48037ab88695042ebc602a8aa5cc476c023a5b2","lane":"client-lint","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":65,"stamp":"8a2b78d6a01180882e2a5c2adcf76879","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}
Ci-Attestation: {"at":1795073323,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"f1bb71c2f1ba8eb2a774688db401e491819e57be0fb563fb02fa4243fd610b3f","lane":"client-test-x86_64-unknown-linux-gnu","parents":["7c1d3d60e57cb753edc275f2bad190e8d1dc087c"],"secs":220,"stamp":"01dd525b8353ea6069b3129648132d59","tree":"9f9dda86003a0753e3056b56f0fc45540665253c","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"cd6fe2a83f6953d7f75e81a99ec1f7588737c9c8","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core+.h.c","libobs/obs-audio-info-queries.c.h","libobs/obs-video-stats-queries.c.h","libobs/obs.c.h","test/cmocka/build/test-graph.json","test/cmocka/test_audio_info_queries.c","test/cmocka/test_video_stats_queries.c","test/cmocka/tests.d/test_audio_info_queries.cmake","test/cmocka/tests.d/test_video_stats_queries.cmake"],"head":"a5948c909bfcce52a1c40b95e8f7e8b7444356e7","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":"0524efdefd51af2341b7eb282cc39526543e904ba25e6a300f15a26157ce3dd7","tree":"9f9dda86003a0753e3056b56f0fc45540665253c"}}
@rdoupe
rdoupe force-pushed the test/5169-5171-audio-info-video-stats branch from 0c19d90 to 107dfc2 Compare November 19, 2026 07:28
@rdoupe

rdoupe commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto master after #5201 extracted obs_enum_input_types from the same spot in libobs/obs.c.h (one conflict, resolved by dropping both blocks; no other change). OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests "test_audio_info_queries|test_video_stats_queries": 1025/1025 on both builds, plus the repeat pass; ./lint ok.

@rdoupe
rdoupe added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 4f62019 Nov 19, 2026
42 checks passed
@rdoupe
rdoupe deleted the test/5169-5171-audio-info-video-stats branch November 19, 2026 08:48
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to Done in obs-rust Multiview Nov 19, 2026
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.

1 participant