Repository navigation
obs-output: swap output total-bytes query to safe Rust (Refs #5208) - #5223
Merged
Merged
Conversation
…Refs #5208) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
obs_output_get_total_bytes() moves to obs-output. The hidden
obs_output_total_bytes_fields() adapter lends the callback slot, the two
delay flags and context.data, formed only after the NULL check, so each
read stays where the C reads it. The original C stays in a reference-only
unity group and in the oracle for the differential test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ci-Attestation: {"at":1795083185,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"c2ca72b4a6605548035815d4e08208dc","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083185,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"7896c9bc78dbe2fa913a0901aacdaf46","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083185,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"c118b7ce5c9dee09264a1cad01b0599c","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083185,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"9c78a530aa3d93124a56da9f5b74a8a6","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083087,"gate":"general/all/client-lint","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"714ad6e38e2df6da4f264710a6022c34","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083185,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"32f8b9e5dc4e127946413263d6485855","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083088,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"9d95d1cea5d4c14226c7d929d310223a","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083088,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"1849ad21e700d4b719fd6a627ae2b165","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083088,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"bb092cd54756b29544d3d82c0a6e32e5","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083088,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"3c311ac94c2f3371ed4fc01408396ad4","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083087,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"adea2a970e2e63e4a8a825c120113d57","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083087,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"2af1858c064e9464eb5c9e552a02119f","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083088,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"74df2eb97655093cb7bdc978f24cccc6","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083088,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"37e3b8ab00bcda04a75faeee3f9952fc","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083087,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"224bd85ee3b4c670f62c56655668ac79","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083088,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"c9197a59db0826a54b53d5384b4cb246","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083087,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"727b41fbd36def3e20b633e64b4b1a6d","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083087,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"e4fb482ee4106c2a46fe7e7be370ed2b0a24ca78e6ff36a2e7d2462f2b387d16","lane":"client-lint","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":96,"stamp":"28ec1b6a1c1b10c54eac25eda0d94e92","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Ci-Attestation: {"at":1795083422,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"3694626f353701b531ec1fe85e272ed98af546a39d9de3ab32cb6bbdbb186a0f","lane":"client-test-x86_64-unknown-linux-gnu","parents":["5cc82e0f0dca8b27593a82e8e6af8cdc2f9e362c"],"secs":237,"stamp":"3adb475a49a2a8917ffc49b711a5ba98","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127","v":1,"via":"run"}
Client-Checks: {"checks":{"base":"c037c2b3ba6db8681433cda92f7d828188cf60af","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-output+.h.c","libobs/build/libobs.ported-output-total-bytes+.h.c","libobs/build/ported-source-sets/output-total-bytes.json","libobs/cmake/rust-exports.d/obs-output-output_total_bytes.txt","libobs/obs-internal.h","libobs/obs-output-total-bytes-fields.c.h","libobs/obs-output-total-bytes-query-support.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_output_total_bytes_swap_is_registered.rs","rust/obs-c-oracle/oracle/output_total_bytes.c","rust/obs-output/src/ffi/mod.rs","rust/obs-output/src/ffi/output_total_bytes.rs","rust/obs-output/src/lib.rs","rust/obs-output/src/output_total_bytes.rs","rust/obs-output/tests/output/main.rs","rust/obs-output/tests/output/output_total_bytes.rs","rust/obs-output/tests/output/output_total_bytes_parity.rs","test/cmocka/output-total-bytes-link-support.c","test/cmocka/tests.d/output_total_bytes_link_support.cmake"],"head":"d87b9f2a4f7f5f303326df88070134e20238bfcc","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":"d0bf592d2999a87cdfeef770dff826efa6a2ea1ce2dc175d0421fc44b753f34b","tree":"5f5825c58ae1f13aa0f5345ff0b2fe132c07f127"}}
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 #5208
Moves
obs_output_get_total_bytes()toobs-outputin hybrid libobs. The prerequisite extraction (#5207) left it alone inlibobs/obs-output-total-bytes-query.c.h.What changes
obs-output::output_total_bytes: safe core over aHosttrait. The order matches the C: the NULL diagnostic, the callback check before the delay loads, short-circuitdelay_active && !delay_capturing, then one dispatch.obs-output::ffi::output_total_bytes: the export. Only after the NULL check does the hidden adapterobs_output_total_bytes_fields()(newobs-output-total-bytes-fields.c.h, declared inobs-internal.h) hand over the addresses ofinfo.get_total_bytes,delay_active,delay_capturingandcontext.data. Nothing is copied up front. The callback slot is read again at dispatch, as the C reads it twice, andcontext.datais read at the call. The delay flags areAtomicBoolSeqCst loads, the same asos_atomic_load_bool.struct obs_outputis not mirrored.libobs.ported-output-total-bytes+. Its twostatic inlinedelay helpers come fromobs-output-total-bytes-query-support.c.h, an unchanged copy of the ones inobs-output.c.h, because that group no longer shares a unity build withobs-output.c.h. The oracle compiles the same two files.*_rustconsumers, native registration test, README row.No public header, existing C test, workflow or WebSocket edits. No new test executable: the tests are modules in
obs-tests-core.Evidence
RED (5cc82e0, safe-core mirrors against the stub):
GREEN (c37ff17):
soldr cargo test -p obs-data --test obs-tests-core output_total_bytes: 4 passed (2 Tier 1 mirrors, a real-header layout check, and the Tier 3 differential: all 48 valid flag combinations × 6 edge results plus 256 proptest cases, original C against Rust, with an independent expected-value assertion).!host.delay_capturing()from the core makesedge_matrix_matches_cfail atflags=0xd(left[0, 0, 0, 0, …], right[0, 1, 0, 1, …]).soldr cargo test -p obs-studio-rust --test obs-tests-app canonical_output_total_bytes: 1 passed.OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 3 --tests 'test_output_total_bytes_query|test_encoder_output_getters'): the full suite passes, 1026/1026 on hybrid (ON) and on the C reference (OFF). Both selected tests pass 3× on each.libobs exported symbols, C vs Rust: IDENTICAL (1769 symbols).OBS_CMOCKA_LINK=true uv run --no-project ci/windows_link_check.py: Windows MSVC and macOS arm64 hybrid libobs and all 55*_rustfixtures link../lint: ok.No intentional differences. Tier 4 does not apply.
🤖 Generated with Claude Code