Repository navigation
obs-source: port obs_source_update_async_video and its check_to_swap_bgrx_bgra step to Rust (Fixes #5938) - #5940
Merged
Merged
Conversation
rdoupe
marked this pull request as draft
November 29, 2026 13:52
…(Refs #5938) Move obs_source_update_async_video() and its two static steps, check_to_swap_bgrx_bgra() and recreate_async_texture(), out of obs-source.c.h into obs-source-async-update.c.h (live group libobs.core-source), unchanged. obs_source_update_async_video() loses its static: obs-source.c.h declares it (no EXPORT) for source_render_video(), as it does async_tick(). No behavior change. The new test_source_async_update_video characterizes them through the real libobs: a tick callback outputs a frame, the source's own tick takes it and sizes its textures, and in the next tick the callback sets the case's fields and renders the source on the video thread. 12 cases: a frame uploaded and drawn (taken, given back to the cache, timing re-anchored, async_update_texture and async_textures_stale cleared); no update (taken and re-anchored, the stale texture not drawn); already rendered this tick (nothing at all); a second render in a tick (draws only); no current frame (only async_rendered set); decoupled and unbuffered (no re-anchor), and either one alone (re-anchored); a BGRX frame on a BGRA texture and a BGRA frame on a BGRX texture (recreated in the frame's format, same size), with and without the upload; matching formats (the texture kept). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ED (Refs #5938) The safe core's Host trait (async_rendered, obs_source_get_frame() and obs_source_release_frame(), the first texture's format, width and height, its destroy and create, a frame's format and timestamp, async_decoupled, async_unbuffered, audio_buf_mutex, the canvas frame time, timing_adjust, timing_set, async_update_texture, update_async_textures(), async_textures_stale and async_last_rendered_ts) and todo!() steps, with 15 Tier 1 tests over a recording model: the frame uploaded, re-anchored and given back in the C's order; no upload; already rendered (only the flag read); a second render taking nothing; no frame (only async_rendered set); async_unbuffered read only for a decoupled source, and decoupled and unbuffered keeping the timing; the timing difference wrapping as the C's unsigned one; the swap before the re-anchor; both swaps, no swap for any other texture and frame format pair; and the recreate reading the width and height before the destroy, a zero size included. The model fails a test on anything but the frame time, the timestamp and the timing fields touched under audio_buf_mutex. All 15 fail on the todo!() core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795960146,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":80,"stamp":"e4a320a62d6e6e5eb760b262d845f811","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960146,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":80,"stamp":"629ce0e9f96a3b2b09a7a247c6d123ba","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960146,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":80,"stamp":"b4711d140d5a551796268d8df920b80f","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960146,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":80,"stamp":"bbc18de5254a83a5fb2a2967c557db8b","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"general/all/client-lint","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"d176833890cb35a3edf099be3e1a4c0a","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960146,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":80,"stamp":"0670d8c8352472db21c0fc6112ba8152","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960065,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"83d6441bcce901cba7c48cb17576188d","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960065,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"556f958829da8fba1e81e9b1e2df878b","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"533cfa67a2500c03679147a377367d78","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"e2be867852413f0382e38ad8fe13cb2b","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"229ee2d7a689214a0c40df8ecebfc1ca","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"636879a53c5f7bd07aff727564aa2c6c","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"98d07ec9831b5e18a9bff0ab9a89cdc2","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960065,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"80a5e99d6ed41d5ab6bcb8ee481d4da8","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"b308d0188290013d20776eea2d05090b","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"37e7a5e234a91652d98f6e662f19bbdb","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"469a1162e02ada9dede33e95f78baf49","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"} Ci-Attestation: {"at":1795960064,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"b19d4880e0552b9d2af911ec7ddb27a653e144e6dc7834f4e8234a4d7e0d0f39","lane":"client-lint","parents":["5310a22b0583c61977f192c914baf8f791858e57"],"secs":74,"stamp":"a87f0ecb5367842b71b866c0c05ef298","tree":"d496071f7efe6c0621e08821ca280729e9103e03","v":1,"via":"run"}
… GREEN (Fixes #5938) obs_source_update_async_video(), check_to_swap_bgrx_bgra() and recreate_async_texture() are now the safe core in obs-source::async_update over a Host trait, exported as the hidden obs_source_update_async_video() in obs-source::ffi::source_async_update (rust-hidden.d). The fields, audio_buf_mutex, the first texture's calls, the frame's fields, the canvas frame time and the calls of obs_source_get_frame(), obs_source_release_frame() and update_async_textures() stay C, one access per adapter, in obs-source-async-update-fields.c.h (live group core-source, no EXPORT). The original moves to the reference-only group libobs.ported-source-async-update. Tier 3 runs the original C in obs-c-oracle against the Rust export over a grid of render states, frames, texture and frame format pairs, flags, upload results and clobbers that flip fields, move the frame's timestamp and repoint the first texture mid-call, plus a proptest, comparing the fields, frames, texture table, the call log and every other byte, and rejects ten mutants. No intentional differences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ci-Attestation: {"at":1795961701,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":76,"stamp":"cbe692d134bfd74ad68bf51fe557a4c6","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961701,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":76,"stamp":"e8900ef2592d5f443f8f6f4ea14bde8f","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961701,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":76,"stamp":"7bbc27ded71e27a7f4a041f868125383","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961701,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":76,"stamp":"061af4dff0c89519352b56b7ee4c9643","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"general/all/client-lint","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"0c057f0222a2381bbf26d7bf905c1545","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961701,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":76,"stamp":"0cea2127c83a2c5907a042f668ec60dd","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"c74697c68bdcf6f294ca678e01cfbb66","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"d2c0e71644aaa09876d49f1524ccc690","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"e9de6337c076de4ec7269c6ea0f55aab","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"46576bc2eafb999725bf1400781c8490","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"52389177329a0fac1238bd3047faa845","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"e10613febb2312b6c2bf10b5a0956b34","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"c85fb3ce4368a663ea4008a9e5c4a3f0","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"723a4b944c4ec17903f762dac0f70597","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"21f5e8c23c0c0ba7dea6d9a26f5c9288","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"9f4f0f3a2eac6880b3f15e1b75465614","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"3ea6205f9871112382850271b499bd17","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795961624,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"57c00b9305be9192db99880fbf25bd42f284058b2f0db736d102cbdba5dae36e","lane":"client-lint","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":86,"stamp":"203252b3871ceac1c3884df737066bc8","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Ci-Attestation: {"at":1795962005,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"cb04ba71b692326b174f35238575ef1a4c14486cdb008a64873f14ff9e1efb22","lane":"client-test-x86_64-unknown-linux-gnu","parents":["c86baf4e457a9b8749bb91c2fb8acb61b1e30640"],"secs":304,"stamp":"4c87b1f307a8d9dfc66011f29caccf56","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9","v":1,"via":"run"} Client-Checks: {"checks":{"base":"52348570f53554c89fbbde003a158dcf7dc51bb1","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-source+.h.c","libobs/build/libobs.ported-source-async-update+.h.c","libobs/build/ported-source-sets/source-async-update.json","libobs/cmake/rust-hidden.d/obs-source-source_async_update.txt","libobs/obs-source-async-update-fields.c.h","libobs/obs-source-async-update.c.h","libobs/obs-source.c.h","rust/README.md","rust/obs-build/tests/native.rs","rust/obs-build/tests/native/registration/canonical_source_async_update_swap_is_registered.rs","rust/obs-c-oracle/oracle.d/source-async-update.list","rust/obs-c-oracle/oracle/source_async_update.c","rust/obs-source/src/async_update.rs","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_async_update.rs","rust/obs-source/src/ffi/source_async_upload.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/async_update.rs","rust/obs-source/tests/source/async_update_parity.rs","rust/obs-source/tests/source/main.rs","test/cmocka/build/test-graph.json","test/cmocka/test_source_async_update_video.c","test/cmocka/tests.d/test_source_async_update_video.cmake"],"head":"a05bb460a099c37c8e9208f0cdd70fd80d0775f6","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":"e6b78a50eb37955bf66e09b9174d34242f290246cdeedd097d7b86f0f338e6f2","tree":"b08f4d91eee2723e1710aa82bbc5e859e5ab8bf9"}}
rdoupe
force-pushed
the
port/5938-async-update-video
branch
from
November 29, 2026 14:20
c86c483 to
761c30d
Compare
rdoupe
marked this pull request as ready for review
November 29, 2026 14:20
zackees
reviewed
Nov 29, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: LGTM. It has the usual port shape:
- Extraction: a verbatim extraction into
obs-source-async-update.c.hand the fields adapter, with the hidden export throughrust-hidden.d. - Tests: a new Tier 2
test_source_async_update_video.c, Tier 1async_update.rs, Tier 3async_update_parity.rsagainst the oracle, and a canonical-swap registration test. source_async_upload.rs: the small change there reroutes it to the new step.- Rules: a Test cost line, and no existing C test or public header edited.
- Status: auto-merge on.
zackees
enabled auto-merge
November 29, 2026 14:21
This was referenced Nov 29, 2026
This was referenced Nov 29, 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.
Fixes #5938.
This ports
obs_source_update_async_video(), with itscheck_to_swap_bgrx_bgra()andrecreate_async_texture()steps, toobs-source, in the shape of #5930 and #5935.source_render_video()runs it once per render for every async source (media, cameras, capture cards) before it draws: it takes the next frame and uploads it into the source's textures. Every decision in it was already Rust (the BGRX/BGRA swap and the timing re-anchor inobs-source::async_upload, andobs_source_get_frame()/obs_source_release_frame()from #5757). What moves now is the glue on the source's fields,audio_buf_mutex, the first texture and the frame.What changes
libobs: extract obs_source_update_async_video and its steps verbatim). The three functions move unchanged intolibobs/obs-source-async-update.c.h(live grouplibobs.core-source).obs_source_update_async_video()loses itsstatic;obs-source.c.hdeclares it (noEXPORT) forsource_render_video(), as it doesasync_tick(). The new cmockatest_source_async_update_videocharacterizes it through the real libobs: a tick callback outputs a frame, the source's own tick takes it and sizes its textures, and in the next tick the callback sets the case's fields and renders the source on the video thread. 12 cases: a frame uploaded and drawn; no upload (the stale texture not drawn); already rendered this tick; a second render in a tick; no frame; decoupled and unbuffered (no re-anchor) and either alone (re-anchored); a BGRX frame on a BGRA texture and the reverse, with and without the upload; matching formats.Hosttrait andtodo!()steps, with 15 Tier 1 tests over a recording model that fails a test on anything but the frame time, the timestamp and the timing fields touched underaudio_buf_mutex.obs-source::async_update, the hidden export inobs-source::ffi::source_async_update(rust-hidden.d), one-access adapters inlibobs/obs-source-async-update-fields.c.h, and the original moved to the reference-only grouplibobs.ported-source-async-update. Tier 3 inobs-c-oracleruns the original C against the Rust export over shared stand-ins for the lock, the frame time, the frame get and release, the upload and the five texture calls, with clobbers that flip fields, move the frame's timestamp and repoint the first texture mid-call; it compares the fields, frames, texture table, call log and every other byte over a grid and a proptest, and rejects ten mutants.No intentional differences from C. The
rust/README.mdrow is added; no user-visible change, so nodocs/features.mdline.Evidence
RED, at the RED commit:
GREEN, at the head:
Tier 2,
OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests test_source_async_update_videoat the head:The characterization test also passed 12/12 against both libraries at the extraction commit, run directly from the kept build volume. Its first run there caught a bad assertion of mine (a recreated texture can get the destroyed one's address from the allocator), dropped before the commit; the format and size checks stay.
./lintpasses.Test cost
New Rust tests, each run alone (
--exact, one thread): longest 0.09 s (rejects_the_mutants), peak RSS 22.6 MB (matches_c_on_random_renders), no threads spawned. The new cmocka test takes about 3 s per library.🤖 Generated with Claude Code