Repository navigation
obs-source: port obs_source_frame_copy to Rust (Fixes #5714) - #5741
Merged
Merged
Conversation
rdoupe
force-pushed
the
port/5714-frame-copy
branch
from
November 25, 2026 23:40
57269c8 to
69287a0
Compare
Collaborator
Author
|
Rebased onto master (frame init moved to its own ported group in #5634, so the core-source group and the module lists conflicted). After the rebase: |
rdoupe
marked this pull request as ready for review
November 26, 2026 00:07
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 26, 2026
Moves frame_copy_lines, copy_frame_data_plane, copy_frame_data and obs_source_frame_copy, with the plane-count _Static_assert, into libobs/obs-source-frame-copy-data.c.h in the live core-source group. cache_video() and the two preload paths now call the exported obs_source_frame_copy() (it only calls copy_frame_data()), so they no longer need the static function. No behavior change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cmocka test through the exported obs_source_frame_copy() on frames of the same format and size, the source from obs_source_frame_create(): every format's planes at four sizes with equal line sizes, then with the destination's line sizes longer, shorter and mixed per plane (each row copies the smaller line size, the rest of a longer destination row stays untouched; P216 and P416 copy no plane), the metadata copied bit for bit, the colour range only when the source is not full range, and format, size, data, line sizes, refs and prev_frame left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tier 1 mirrors of test_source_frame_copy.c (same cases, formats, sizes, line sizes and fills) and new edge cases (the order of the writes, the plane extents with wrapping row starts, short slices) against a todo!() core in obs_source::frame_copy_data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Safe core frame_copy_data::copy_frame_data writes the metadata, asks the
existing frame_copy::copy_plan, writes the colour range when the plan
says so and runs each plane copy through frame_copy_data::copy_plane over
slices the shim builds from plane_extent (row starts in u32, as the C
computes them). The C ABI shim mirrors the public struct obs_source_frame
and writes each field through the pointer. cache_video() and the two
preload paths reach it through the exported obs_source_frame_copy(). The
extracted C moves to the reference-only group
libobs.ported-source-frame-copy-data. Tier 3 parity against the original
C over every format, seven sizes and six line-size patterns, and a
proptest over same-shape frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ci-Attestation: {"at":1795655480,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":93,"stamp":"6eb78adf660271b68d6d201bef38bf04","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655480,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":93,"stamp":"ed13aecc41336dbc8b58ae2eb145a132","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655480,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":93,"stamp":"a5323f8165dceb55bdbe6f07b1ad47ae","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655480,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":93,"stamp":"f03b85df1b3a02cf2d16a5722a3fd8bd","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"general/all/client-lint","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"5f66ddf545df2d40d90292ac818dfa62","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655480,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":93,"stamp":"f589f637c69716edcbc2c55dbb73d317","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"f60685b3f19de6abefba990c81b14d60","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"6f0964d4948f8514891947565aebbf36","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"575b97a9c110507b09bab1d256b0f402","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"3e3b533c9d90ef9e16c8014d42fa2aeb","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"96ad65cd71bc5cbae9f26f9a58edec69","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"e3c586bd31587e8daa68b139c7de9a4f","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"67a717335f95c4c04518b6e4ff092f4a","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"3f0b0529180c22c94a9f2650cde61e36","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"8b8b15aa697252ced257f7f0efaadf8d","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"21c24c146cb8d10a6e6e5172ac248f95","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"f37f67fbb787ff7ecf71e8ec4e561bb1","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655386,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"ba618f321d17f7ec6047b7687078ec63937be1a44724e00e36fb766b846cb0d0","lane":"client-lint","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":10,"stamp":"32e893afc3044d736e3bcfd9172140c9","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Ci-Attestation: {"at":1795655644,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"49587e5440f1978772c3d9d3e97ce51c084e66021005445d96ceb793304b201f","lane":"client-test-x86_64-unknown-linux-gnu","parents":["736fd91a366abcdc32abafce77e41fcbfe4e67c0"],"secs":164,"stamp":"32467eaf3c4731135d949704421f7472","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44","v":1,"via":"run"}
Client-Checks: {"checks":{"base":"7f54bf96e78bc88fc3ea6a698513e38131e7932e","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.ported-source-frame-copy-data+.h.c","libobs/build/ported-source-sets/source-frame-copy-data.json","libobs/cmake/rust-exports.d/obs-source-source_frame_copy_data.txt","libobs/obs-source-frame-copy-data.c.h","libobs/obs-source.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_source_frame_copy_data_swap_is_registered.rs","rust/obs-c-oracle/oracle.d/source-frame-copy-data.list","rust/obs-c-oracle/oracle/source_frame_copy_data.c","rust/obs-source/Cargo.toml","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_frame_copy_data.rs","rust/obs-source/src/frame_copy_data.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/frame_copy_data.rs","rust/obs-source/tests/source/frame_copy_data_parity.rs","rust/obs-source/tests/source/main.rs","test/cmocka/build/test-graph.json","test/cmocka/test_source_frame_copy.c","test/cmocka/tests.d/test_source_frame_copy.cmake"],"head":"e543bfee7ee8cc80188acce181553d85642043cb","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":"3fb3223eb3447aea49eca9e9441be52328bdccc7f3f1f03377b40ecf99ebe582","tree":"9727ee1e3c9c055f0ae3737a61c4c91dd3f58d44"}}
rdoupe
force-pushed
the
port/5714-frame-copy
branch
from
November 26, 2026 01:14
69287a0 to
59d8dbc
Compare
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 #5714.
Ports the exported
obs_source_frame_copy()and the privatecopy_frame_data()/copy_frame_data_plane()/frame_copy_lines()it runs to Rust in obs-source. The copy plan itself (#2215) was already Rust; this moves the code that carries it out.Commits
6bd94e1bdlibobs: extract, no behavior change. Movesframe_copy_lines,copy_frame_data_plane,copy_frame_dataandobs_source_frame_copy(with the plane-count_Static_assert) verbatim intolibobs/obs-source-frame-copy-data.c.hin the live core-source group.cache_video()and the two preload paths now call the exportedobs_source_frame_copy(), which only callscopy_frame_data(), so the three internal callers stay on one shared copy.7e28ab03atest: characterization.test/cmocka/test_source_frame_copy.cthrough the exportedobs_source_frame_copy()against both the C reference and hybrid libobs, frames fromobs_source_frame_create(): every format's planes at four sizes with equal line sizes, then destination line sizes longer, shorter and mixed per plane (each row copies the smaller line size, the rest of a longer destination row is untouched; P216 and P416 copy no plane, as upstream does), metadata copied bit for bit, the colour range only when the source is not full range, and format, size, data, line sizes, refs andprev_frameleft alone.939a0f1bctest: RED. Tier 1 mirrors of the cmocka cases plus edge cases (the order of the writes, plane extents with wrapping row starts, short slices) against atodo!()core.57269c821obs-source: GREEN. Safe corerust/obs-source/src/frame_copy_data.rswrites the metadata, asks the existingframe_copy::copy_plan, writes the colour range when the plan says so and runs each plane copy over slices the shim builds fromplane_extent(row starts inu32, as the C computes them). The C ABI shimffi/source_frame_copy_data.rsmirrors the publicstruct obs_source_frame. The extracted C moves unchanged to the reference-only grouplibobs.ported-source-frame-copy-data. Tier 3 (frame_copy_data_parity.rs, oraclesource_frame_copy_data.c) runs the original C and the Rust export over every format, seven sizes and six line-size patterns, plus a proptest over same-shape frames, and checks the struct layout against C.No public header, existing C test, frontend, plugin or obs-websocket change. Exports unchanged (1769 symbols, identical between the C and Rust builds). No intentional differences.
Note: #5721 (draft, #5720) adds a characterization of the same function under the same file name. This PR was claimed first (#5714) and carries its own; whichever lands second rebases onto the other.
Evidence
RED (
939a0f1bc):GREEN (head, on
dac430e4a):🤖 Generated with Claude Code