Repository navigation
libobs: Add the module list seam - #4288
Merged
Merged
Conversation
The module list calls (obs-module-lists.c) read struct obs_core and struct obs_module directly and push onto their lists with da_push_back(). Their port needs a seam that reaches the same fields without the layouts of obs-internal.h, as the audio tick's port reaches its fields through obs-audio-seam.h. obs-module-lists-seam.h declares it, hidden in libobs like the core-audio seam: the core (whether obs is set, first_module, module_config_path, and the struct darray inside module_paths, safe_modules and disabled_modules) and a module (next, file, data_path, mod_name, and the struct darray inside sources, outputs, encoders and services). obs-module-lists-seam.c is in libobs.core, ahead of obs-module-lists.c, with stub bodies that read nothing. test_module_lists_seam pins the seam. The accessors are hidden, so it builds the seam into itself and runs it on a stand-in core and stand-in modules. 14 cases: each read against the field it wraps, each darray address against the typed list behind it (a push through either shows in the other), and a module's four lists against libobs's own obs_module_add_*() calls. All 14 fail on the stubs. Refs #4219.
The module-list seam's accessors get their bodies, each a single read or field address copied from the line of obs-module-lists.c it wraps, and named beside it: - the core: !obs (obs_add_module_path(), obs_add_safe_module(), obs_add_disabled_module()), obs->first_module (obs_log_loaded_modules()), obs->module_config_path (obs_module_get_config_path()), and the darrays that da_push_back() pushes onto in module_paths, safe_modules and disabled_modules; - a module: next and file (obs_log_loaded_modules()), data_path (obs_find_module_file()), mod_name (obs_module_get_config_path()), and the darrays of sources, outputs, encoders and services (obs_module_add_*()). No C caller changes: obs-module-lists.c keeps its direct reads until its port replaces them. test_module_lists_seam passes 14/14 on the C, hybrid and C reference builds, and their export sets are identical and unchanged, with the accessors local. Fixes #4219. Local-Gate: v1 tree=cc727d26e0b4766521fc31800c23d9848fdec011 secs=2615 lanes=lint:run,dylint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a Ci-Attestation: {"at":1794253799,"gate":"rust/all/fmt","host":"linux-x86_64","key":"4fbe32c46adc8131bd81a7e65601373c6154c1d1bfa30def12dbd029d90cb9d7","lane":"lint","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":46,"stamp":"ab75929fc5197471c3fa97af6475ac7f","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"} Ci-Attestation: {"at":1794253799,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"4fbe32c46adc8131bd81a7e65601373c6154c1d1bfa30def12dbd029d90cb9d7","lane":"lint","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":46,"stamp":"6a3f350351d58858669a2cfd49c1beba","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"} Ci-Attestation: {"at":1794253799,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"ec5768e784bef6807b3813872e8db2ce353590b2711c959186a37e5c866219c2","lane":"rust-test","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":289,"stamp":"000ac99ae0ed3369a24d707b4771fe62","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"} Ci-Attestation: {"at":1794253799,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"1556b385bcd76572b67f277c42a64015d962da8b5cfbabcc2b3fd4e68d7bb5eb","lane":"cross","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":185,"stamp":"6e0245860747da053d1f96068a8937cc","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"} Ci-Attestation: {"at":1794253799,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"1556b385bcd76572b67f277c42a64015d962da8b5cfbabcc2b3fd4e68d7bb5eb","lane":"cross","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":185,"stamp":"24d01230b6bddf0cc00270135d9eedd5","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"} Ci-Attestation: {"at":1794253799,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"1556b385bcd76572b67f277c42a64015d962da8b5cfbabcc2b3fd4e68d7bb5eb","lane":"cross","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":185,"stamp":"bfc3f67f958fc329e5e4a52fa72af9b8","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"} Ci-Attestation: {"at":1794253799,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"1556b385bcd76572b67f277c42a64015d962da8b5cfbabcc2b3fd4e68d7bb5eb","lane":"cross","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":185,"stamp":"4b803f149be8b002a0e9098a03888273","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"} Ci-Attestation: {"at":1794253799,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"0ed4f7626b725b24dea1fd494be3276a4ae777c571520127239cc4d80c3a9eeb","lane":"tier2-linux","parents":["e093438f17adada74ee6343fafcf36e414f9e8a5"],"secs":2615,"stamp":"5c008a2839cb6c94d43218e311597b7a","tree":"cc727d26e0b4766521fc31800c23d9848fdec011","v":1,"via":"run"}
rdoupe
force-pushed
the
fix/rust-port-add-the-module-list-se-717
branch
from
November 9, 2026 19:50
707c9ac to
090fb34
Compare
Collaborator
Author
|
Handed off to the coordinator |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 9, 2026
This was referenced Nov 10, 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 #4219
What and why
The module-list seam that the port of the module list calls (
libobs/obs-module-lists.c.h, extracted fromobs-module.c.hin #4139) needs, before that port. There is no Rust and no change in behaviour: it is new C in a new file, and nothing calls it yet.The list calls (
obs_log_loaded_modules,obs_module_add_source/_output/_encoder/_service,obs_find_module_file,obs_module_get_config_path,obs_add_module_path,obs_add_safe_module,obs_add_disabled_module) readstruct obs_coreandstruct obs_moduledirectly and push onto their lists withda_push_back(). The port intoobs-core, beside the module rules that are already Rust (module_paths,module_names,module_load_rules), reaches the same fields through this seam, without the layouts ofobs-internal.h("Public and internal boundaries", testing-policy.md), as the audio tick's port reaches its fields throughobs-audio-seam.h.libobs/obs-module-lists-seam.hdeclares the accessors, hidden in libobs (notEXPORT) like the core-audio seam's. Each is a single read or field address, copied from the line ofobs-module-lists.c.hit wraps:obsis set (the!obschecks ofobs_add_module_path,obs_add_safe_moduleandobs_add_disabled_module);first_module;module_config_path; and thestruct darrayinsidemodule_paths(ofstruct obs_module_path),safe_modulesanddisabled_modules(ofchar *), the lists those three calls push onto;nextandfile;data_path;mod_name; and thestruct darrayinsidesources,outputs,encodersandservices(ofchar *), the lists the fourobs_module_add_*calls push onto.A darray address is the one
da_push_back()takes, so the port pushes onto it withobs-util's darray port and the typed list's element size. None checks its arguments or takes a lock: the list calls take none today, and the header says a caller keeps it that way.libobs/obs-module-lists-seam.c.his live C inlibobs.core, ahead ofobs-module-lists.c.hin the group's sorted order. It stays live C, like the other seams, and never moves into a ported group.libobs.pch.hincludes the header with the otherobs-module.cheaders, andsource-sets.d/LIBOBS_SOURCES.jsonlists it. No C caller changes:obs-module-lists.c.hkeeps its direct reads until the port replaces them.test_module_lists_seampins the seam. The accessors are hidden, so it builds the seam into itself, astest_audio_seamdoes, and runs it on a stand-in core (obs, with only the fields the seam reads) and stand-in modules. It has 14 cases: each read against the field it wraps (the field itself, not a copy), each darray address against the typed list behind it (an element pushed through the address withdarray_push_back()shows in the typed list, and one pushed withda_push_back()on the typed list shows through the address), the lists distinct from each other, and a module's four lists against libobs's ownobs_module_add_*()calls, which take the module they push onto (a NULL id included: it pushes a NULL).RED → GREEN
libobs: Stub the module list seam): the accessors are declared, and their bodies read nothing (NULL, false).test_module_lists_seamfails 14/14 on the C, hybrid and C reference builds (test_has_core: the core is set and the stub says no;test_first_module,test_module_pathsand the others:(nil) != 0x…; the_distinctcases: the stubs' NULLs are equal). Every case fails at an assertion before it touches an address, so none crashes. On the RED commit--lane lintand--test-diff(7547 tests passed, 6 skipped) pass.libobs: Add the module list seam): each body copied from the line it wraps. The first runs were on 707c9ac (on master 643866b); the runs after the rebase onto master f6b01bd are in the last bullet.test_module_lists_seampasses 14/14 on the C, hybrid and C reference builds, under ASan and UBSan, with no leaks (0/14 on the RED commit).ctest -R 'module|seam', under Xvfb, TMPDIR unset) pass on all three builds, none skipped: C 16/16, hybrid 16/16,libobs-c-reference16/16 (rebuilt after the change, its mtime checked).test_source_monitor_only_loadwas left out: it hangs without a sound server, on the C build too.t) in each.--test-diffagainst the base (7547 tests passed, 6 skipped, the same on the RED commit),--lane lint,--lane dylint,--lane crossand the Windows--all-targetsclippy (x86_64-pc-windows-msvc,-D warnings) pass. This PR touches no Rust.ci/checks (test_build_groups,test_ported_sources,test_oracle_standins,test_oracle_msvc,test_sorted_shared_lists,test_test_graph_sorted,test_cmocka_rust_static_guard,test_cmocka_windows_diagnostics,test_cmocka_includes,test_naming),./lint,--lane lint,--lane dylint,--lane crossand the Windows--all-targetsclippy pass again.ci-lint local-gate run: lint, dylint and Tier 2 on Linux (tier2-linux, 822/822 on hybrid libobs and onlibobs-c-reference, 2 skipped on each: the two vivid V4L2 tests that need the vivid driver) pass. Its rust-test lane, and./unittest's, fail only where master does, building theobs-c-oracleoutput pause probe forx86_64-pc-windows-gnu('pthread_mutex_lock' redefined, bug: obs-c-oracle: pthread probe macro redefinition blocks Fast Gate #4069, fixed by the open fix(obs-c-oracle): keep the mingw pthread names around the pause lock probes #4191), after the workspace tests passed (7547 passed, 6 skipped; obs-util 914 passed). So HEAD is not stamped, and PR CI runs the full suite.libobs/build/libobs.pch.h, one#includeof the new seam header):gh workflow run ci.ymlon 090fb34, which runs the Windows, macOS, Ubuntu and Flatpak app builds that PR CI never runs: https://github.com/obs-rust/obs-studio/actions/runs/42612642782. Every app build passed: Windows x64 and arm64, macOS x86_64 and arm64, Ubuntu, Flatpak and the mac-arm64/win-x64 cross compile. The run shows failure only from its Fast Gate rust-test lane, the samex86_64-pc-windows-gnuoutput pause probe build master had then (bug: obs-c-oracle: pthread probe macro redefinition blocks Fast Gate #4069, fixed since by fix(obs-c-oracle): keep the mingw pthread names around the pause lock probes #4191).libobs.core+unity list, where master addedobs-module-init.c.handobs-module-load-locale.c.hbeside this PR's line, and all three lines are kept. The diff against master is still 8 files, 517 lines added and none removed. Runs were on 090fb34:test_module_lists_seam14/14 andctest -R 'module|seam'17/17 (none skipped) on the C, hybrid and C reference builds (all three rebuilt); the export sets identical (1767), with the 14 accessors local; theci/checks,./lintand theport_comparisonbench test pass.ci-lint local-gate runpasses every lane and stamps HEAD: lint, dylint, rust-test (7601 passed, 6 skipped; obs-util 914 passed), cross, and Tier 2 on Linux (829/829 on hybrid libobs and onlibobs-c-reference, 2 skipped on each: the two vivid V4L2 tests).Checklist
master(or the description starts with a Stacked: note)test_module_lists_seamlands with the stubs in e093438 and passes with the bodies in 090fb34, as the core-audio seam did (libobs: Add the core-audio seam #4048). The list calls it wraps keep their existing coverage:test_module_listspasses unchanged on all three builds.docs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): built with scripting ON (PR CI builds no OBS app: rungh workflow run ci.yml --ref <branch>for the full builds) and cross-checked with clang and MSVC (not applicable)