Repository navigation
obs-source: Port the source rename - #4860
Merged
Merged
Conversation
Port test_source_set_name.c 1:1 to Tier 1 tests in the core category binary, against a todo!() core in obs-source::set_name. The model source stands in for what stays in C as the C test sees it: the public source table, the canvas's source table, and the canvas rename, which signals the source, the canvas and, on the main canvas only, the core handler. Each case asserts the C test's handler order (GL, L, LCG, LC, L), every handler's payload with the new name already published, the lookups after the rename and the unchanged-name checks. Add the NULL, empty, unnamed and non-UTF-8 name edges, the NULL source's log line, and the order of every read and call. Refs #4857.
Port obs_source_set_name() to obs-source::set_name. The safe core keeps the original order: the NULL check with its debug line, the unchanged-name check (a NULL or empty request, or a NULL current name, always renames), the canvas rename for a public source that requires a canvas, and otherwise the table rename with its signals: the previous name is copied before the rename, new_name is the context's name after it, privacy is read again before the global source_rename, the local rename always follows, and the payload and the copy are freed after both. C keeps the source and context layouts, the name tables, the canvas rename and signal delivery behind the live adapter obs-source-set-name-fields.c.h, one read or call per function. The shim exports obs_source_set_name; the original file moves into its own ported unity group for the C reference. Refs #4857.
Compile the unchanged extracted setter and the production adapters over the real private source layout, with tracing stand-ins for the canvas rename, the context setters and signal delivery. Fixed and random cases compare every call with its name, every signal with its handler and payload, and the final name and privacy: NULL, empty, equal, occupied, long and non-UTF-8 names, any output flags, private sources, a table setter that flips privacy and a callback that edits the payload. A NULL source writes the same debug line. Planted mutants in the core (privacy not read again, signals swapped, payload built before the rename, canvas path for private scenes, empty names compared, NULL current name kept, no global signal, tables swapped) are each caught. Refs #4857.
Add the rust/README.md row for obs-source::set_name, and name the port in the crate's Cargo.toml description and lib.rs module docs. Fixes #4857. Local-Gate: v1 tree=128b6f029b9c1b7dc80f215b643b2cee92d83d4b secs=2545 lanes=lint:run,dylint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a,client-checks:run,client-swift:n/a,client-lint:run,client-test:run,client-test-x86_64-unknown-linux-gnu:run,client-test-aarch64-unknown-linux-gnu:n/a,client-test-x86_64-pc-windows-msvc:n/a,client-test-aarch64-pc-windows-msvc:n/a,client-test-x86_64-apple-darwin:n/a,client-test-aarch64-apple-darwin:n/a Ci-Attestation: {"at":1794659024,"gate":"rust/all/fmt","host":"linux-x86_64","key":"7966adbb057092a1f36199833b76b0e965fae791b180c7deef559f5ea5c18c1d","lane":"lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":63,"stamp":"0a0e1235b0fd3cedc84c18b0621fecce","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"7966adbb057092a1f36199833b76b0e965fae791b180c7deef559f5ea5c18c1d","lane":"lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":63,"stamp":"b5f19507104cb638b9c83d916f5e9689","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-unknown-linux-gnu/dylint","host":"linux-x86_64","key":"6b959e52b9429f9ff0a111e737208c99d08d885cf52412aa607eff02a0fdc891","lane":"dylint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":0,"stamp":"a9c25575d3be5b9e4150a3ec7ad0b073","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"dda38f4afd5b2dd0113af01e6f13d83df678f62da4f69e3007107575a499d535","lane":"rust-test","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":204,"stamp":"f3eb05935584651b6c1b73d3cf272fe7","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"b93edb872e845fb47d693c8057aec81e7757d25ab7e8fc8bd0ca2872502968ba","lane":"cross","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":79,"stamp":"1a8b6e0f704c33d0a0c8b635756665fd","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"b93edb872e845fb47d693c8057aec81e7757d25ab7e8fc8bd0ca2872502968ba","lane":"cross","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":79,"stamp":"23148dc9ec22d46914de44672ca2dded","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"b93edb872e845fb47d693c8057aec81e7757d25ab7e8fc8bd0ca2872502968ba","lane":"cross","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":79,"stamp":"99d71bada0d1408ced7806b5fe2dd80c","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"b93edb872e845fb47d693c8057aec81e7757d25ab7e8fc8bd0ca2872502968ba","lane":"cross","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":79,"stamp":"44be866d8eac15f4dd3db7ec4b263a3d","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"04c51e3b965232af64e64c7a091f4cbfc8a777fb237c0440ef0358f8633af0ab","lane":"tier2-linux","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":2545,"stamp":"9c962708b86c2f2f72d7620842e7c4a8","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"python/all/self-test","host":"linux-x86_64","key":"becbe960dad8c700fc9febba541f3cae522d5d52177dff0d3d45d49b499f3158","lane":"client-checks","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":55,"stamp":"55055ed7687597959c88c038b3a63573","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"general/all/client-lint","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"7dad8510aaaa542f76ebadbeb854c09d","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"7cb2bd12f4b7510559fdb1c096850c70","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"da330069619f43cbdd9b70b7d2952602","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"0b444de745c4c3f36947beef83672bb7","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"6f281cad723bf4833a0554e3c3b8ea1c","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"da59ce66aab013b3b8be3295981562dd","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"870fda1369db0219c0ae74da6137e2c8","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"447cc2eecbb807ae63909b6416c4dbaf","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"6bc82f5e9654e5ceab7da5acf8c493f7","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"b0984690d86bde19d9b2d5763e6270e6","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"f5c9ab34c614823055c5ebf11315b0dd","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"fe8a9d585c6623a764c1e2600259978e","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"e9630370e0eb5e205a1d00023be6ad3588dbb115ccfc96b0a35d0476fee50ef6","lane":"client-lint","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":50,"stamp":"8763ed6eec999a66edcf270d62a17826","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"} Ci-Attestation: {"at":1794659024,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"86b0f0bf2ec8ed6e718355c4245f8decac53a59ce7d4d9d9628d7992df6e39ad","lane":"client-test-x86_64-unknown-linux-gnu","parents":["4ce7618b0c902868dc9c9a3a88d152c5b36deac2"],"secs":298,"stamp":"1f50541332afbbf86267a661eb706574","tree":"128b6f029b9c1b7dc80f215b643b2cee92d83d4b","v":1,"via":"run"}
rdoupe
force-pushed
the
fix/rust-port-port-the-source-rename-840
branch
from
November 14, 2026 12:24
05cee19 to
1ca2ab3
Compare
rdoupe
marked this pull request as ready for review
November 14, 2026 13:03
Collaborator
Author
|
Handed off to the coordinator |
5 of 7 tasks
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 #4857
What and why
Ports the source rename,
obs_source_set_name()inlibobs/obs-source-set-name.c.h, toobs-source::set_name. The C was extracted and characterized in #4643 (test/cmocka/test_source_set_name.c); this swaps it in hybrid libobs.obs_canvas_rename_source()) for a public source that requires a canvas; otherwise the table path. There the previous name is copied before the rename, the context is renamed through the public source table (with no table for a private source),new_nameis the context's name read after the rename, privacy is read again before the globalsource_rename, the localrenamealways follows, and the payload and the copy are freed after both signals. A private scene that knows its canvas takes the table path, as in C.libobs/obs-source-set-name-fields.c.h(incore-source+, theobs-canvas-set-name-fields.c.hshape), one read or one call per function. No Rust borrow ofcontext.namespans a C call, and the port adds no lock: the table call takes its own, as before.obs_source_set_name(rust-exports.d/obs-source-source_set_name.txt); the original file moves into its own ported group,libobs.ported-source-set-name+, registered inported-source-sets/source-set-name.json, so the C reference keeps it unchanged.No intentional differences from C.
The audio-pause callbacks, planned next to this one, are not in this PR: issue #4375 already has a branch with that port.
RED → GREEN
soldr cargo test -p obs-data --test obs-tests-core -- source::set_name::fails 9/9 Tier 1 tests on thetodo!()core (not yet implemented: obs_source_set_name): the fivetest_source_set_name_*ports and the NULL, empty, unnamed, non-UTF-8 and NULL-source cases. On that commit--test-difffails exactly those 9 (7911 passed, 6 skipped) and the lint lane passes.test_source_set_name.ccase asserts the same handler order (GL,L,LCG,LC,L), payloads, published name, lookups and unchanged-name checks. Tier 1 alone also catches the eight core mutants below. The parity test runs the unchanged extracted C and the Rust ABI over the real private source layout through the production adapters, with tracing stand-ins for the canvas rename, the context setters and signal delivery. It compares every call with its name, every signal with its handler and payload, and the final name and privacy, for NULL, empty, equal, occupied, long and non-UTF-8 names, any output flags, private sources, a table setter that flips privacy and a callback that edits the payload; a NULL source writes the same debug line. Eight planted mutants in the core (privacy not read again, signals swapped, payload built before the rename, canvas path for private scenes, empty names compared, a NULL current name kept, no global signal, tables swapped) are each caught.ctest -R 'source|scene|canvas|context|missing_files|hotkey', under Xvfb): C 195/197, hybrid 218/221, c-ref 218/221, 0 skipped.test_source_set_name,test_context_names,test_canvas_rules_callersand the two hotkey tests that failed in the parallel run pass on all three when run alone (they race forxvfb-run -adisplays under-j8).test_source_audio_settingstimes out on all three, plain C included, because the test host has no sound server.t) in each, and hybrid'sobs_source_set_namecalls the Rust core.ci/windows_link_check.pypasses../unittest: Rust 8524/8524 (6 skipped) and 916/916; Tier 2 in Docker 932/932 against hybrid libobs and libobs-c-reference (2 vivid tests skipped on each).ci/local_gate.py --test-diff: 8508/8508 passed, 6 skipped (before the rebase onto current master;./unittestabove ran after it).--lane lint,--lane dylint,--lane crossok;clippy --target x86_64-pc-windows-msvc --all-targets -D warningsclean.Test cost: new Rust tests: longest 0.02 s (the random parity test), peak RSS 10.6 MB over 20 runs with
OBS_PARITY_CASES=reduced, no own threads (the NULL-source log check re-execs one child, as the other log probes do).Checklist
master(or the description starts with a Stacked: note)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: no warning or flag changes)