Repository navigation
obs-source: port obs_source_get_last_async_ts to Rust (Fixes #5766) - #5767
Merged
Merged
Conversation
Moves the source profiler's async timestamp getter unchanged from obs-source.c.h into libobs/obs-source-async-last-ts-getter.c.h, a member of the live core-source unity group. No Rust, no behavior change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New cmocka test on a test-owned struct obs_source: the getter answers async_last_rendered_ts exactly (0, ordinary timestamps, every single bit, UINT64_MAX) whatever the other bytes hold, writes no byte of the source and logs nothing. The getter is hidden in libobs (obs-internal.h, no EXPORT), so the test compiles its extracted C file into itself, as test_source_texcoords_centered_setter does. NULL is outside the C contract and is not tested. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tier 1 mirrors of test_source_last_async_ts.c against a todo!() stub, async_flag_getters::last_async_ts: the stored timestamp exactly for edge values and every single bit, and nothing written to its neighbours. RED: soldr cargo test -p obs-data --test obs-tests-core -- async_flag_getters:: gives 4 passed, 2 failed (both panic in the todo!()). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The getter joins async_flag_getters beside the async flag reads. The shim reads async_last_rendered_ts through a new address adapter, obs_source_async_last_ts_field(), in the existing async flag fields file, with no NULL check (the C dereferences), no write and no log. It stays hidden as the C was (obs-internal.h, no EXPORT): the name goes into a new rust-hidden.d fragment for the module. The extracted C moves to the reference-only group libobs.ported-source-async-flag-getters. The source-profiler stand-in of the same name in the oracle is gone: the obs-core shim test now reaches the Rust getter, over the same real zeroed oracle source as the output flags. The Rust-static link stubs of the module gain the new adapter, aborting like the existing one. Tier 1 passes; Tier 3 compares the original C and the Rust export on noise-filled real-layout fixtures (edge values, every bit, a proptest), the full source snapshot after each read, and the adapter's field offset against the real header. A shim that clears bit 0 fails parity (reverted). Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1795683304,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":94,"stamp":"a9e743c053ca668df49966173e092b4c","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683304,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":94,"stamp":"ba607311e7f77732ca823a3d59bce3b9","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683304,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":94,"stamp":"c207e600ce8b7247b3b825eb00588a52","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683304,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":94,"stamp":"951c16dd7551a992cc14872ba0c7c7eb","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"general/all/client-lint","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"67e40033f3795eb62bd2310607a24ba2","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683304,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":94,"stamp":"80ff49e819ece30f74b8fa45c9d16d8f","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"46efdcaa10e50d46b72a486999af6aa0","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"55f1e3f86bf0a789f45f097e0b0cdf58","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"454665bd78d4e812bd23fa1372a2534c","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"2c8c2893e2ddea292a45b1a984a3a1dc","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"27a0284e6cdd655361d9c3707cfa6afd","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"320893977cd24ed96e714e8eae5196c3","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"c5f6760317aadf87360234a240367931","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"b1fac1a0b231a55f014f6091c5082aae","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"6a3d8562b0ca9cccbb2b55999e4ac7a7","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"518c7ca5ab1bef98785c9c1c9361bfbb","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"a830f7e45e91c2898709c59846e342e2","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683209,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"0780a1574166fd5e0db798c875e172c843c2312e4666f4d607e380a37dd941e2","lane":"client-lint","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":98,"stamp":"80b129d7f8e59d44fa1646bff51b0349","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Ci-Attestation: {"at":1795683594,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"7813d4f2031da2d4cfc13b22f255164d27211f733757d954e8b3e4bbefe2898e","lane":"client-test-x86_64-unknown-linux-gnu","parents":["ae40452d893dd6dbdb992315b3f96aa98a84bd8f"],"secs":289,"stamp":"2c90813d0e9dc62ac638f4b2b5c14bda","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac","v":1,"via":"run"} Client-Checks: {"checks":{"base":"69df7dfd1d68b826d596ed525ae0e4e5588e8eb8","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.ported-source-async-flag-getters+.h.c","libobs/cmake/rust-hidden.d/obs-source-source_async_flag_getters.txt","libobs/obs-internal.h","libobs/obs-source-async-flag-fields.c.h","libobs/obs-source-async-last-ts-getter.c.h","libobs/obs-source.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_source_last_async_ts_swap_is_registered.rs","rust/obs-c-oracle/oracle/source_async_flag_getters.c","rust/obs-c-oracle/oracle/source_profiler_host.c","rust/obs-source/src/async_flag_getters.rs","rust/obs-source/src/ffi/source_async_flag_getters.rs","rust/obs-source/tests/source/async_flag_getters.rs","rust/obs-source/tests/source/async_flag_getters_parity.rs","test/cmocka/build/test-graph.json","test/cmocka/source-async-flag-getter-link-stubs.c","test/cmocka/test_source_last_async_ts.c","test/cmocka/tests.d/test_source_last_async_ts.cmake"],"head":"4a16be1d976fa7fa76a7070fbff1160118dc26d8","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":"08653b2970c01f5b6d927b439406e96daf8f89d56cc6a9b51ab0a40cb31951f9","tree":"684a4c7723f7471bb9905b63a885c1dce8c004ac"}}
rdoupe
marked this pull request as ready for review
November 26, 2026 10:11
rdoupe
enabled auto-merge
November 26, 2026 10:11
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.
Fixes #5766
What changes
obs_source_get_last_async_ts(), the hidden libobs getter the source profiler reads for an async video source each tick, moves fromlibobs/obs-source.c.htoobs-source::async_flag_getters, beside the async flag getters.Commits, in order:
libobs/obs-source-async-last-ts-getter.c.h, still in the livelibobs.core-sourcegroup. No behavior change.test/cmocka/test_source_last_async_ts.con a test-ownedstruct obs_source: the getter answersasync_last_rendered_tsexactly (0, ordinary timestamps, every single bit,UINT64_MAX) whatever the other bytes hold, writes no byte and logs nothing. The getter is hidden (obs-internal.h, noEXPORT), so the test compiles the extracted C file into itself, astest_source_texcoords_centered_setterdoes (obs-source: port obs_source_set_texcoords_centered to Rust (Fixes #5599) #5600).todo!()core.async_flag_getters::last_async_tsand a hidden shim (rust-hidden.d/obs-source-source_async_flag_getters.txt). The shim reads through a new address adapter,obs_source_async_last_ts_field(), added to the existingobs-source-async-flag-fields.c.h. No NULL check, as in the C (it dereferences).libobs.ported-source-async-flag-getters(and to that group's PCH).obs_source_get_output_flagsdoes since rust: port extracted obs_source_get_output_flags to obs-source #5340.source-async-flag-getter-link-stubs.c, 28*_ruststep tests) gain the new adapter, aborting like the existing one.obs-build; rust/README row.No public header, existing C test, WebSocket or workflow change. No intentional differences. Tier 4 does not apply.
Tests
rust/obs-source/tests/source/async_flag_getters.rs): edge values, every bit, neighbours untouched.test_source_last_async_ts,test_source_profilerand the 28 Rust-static step tests that link the stubs, on hybrid libobs and the C reference.async_flag_getters_parity.rs): the original C and the Rust export on noise-filled real-layout fixtures (three noise bytes, edge values, every bit, and a proptest over noise and timestamp), with the full source snapshot compared after every read, and the adapter's field offset against the real header'soffsetof. Mutation check: a shim that clears bit 0 failslast_ts_characterized_edgesandlast_ts_matches_c(reverted).Evidence
RED (
test: RED ...):GREEN:
🤖 Generated with Claude Code