Skip to content

libobs: Add seam calls, move transition stop - #3841

Merged
rdoupe merged 5 commits into
masterfrom
fix/rust-port-add-the-transition-sea-656
Nov 8, 2026
Merged

rdoupe merged 5 commits into
masterfrom
fix/rust-port-add-the-transition-sea-656

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #3835, #3836
Fixes #3835
Fixes #3836

What and why

Two C-only steps the next transition ports need, batched (coordination.md, "Batch one to three similar issues into one PR"). There is no Rust and no change in behaviour; the ports of the transition start and set and of the clock read and stop to rust/obs-source-seam come next and call both.

The transition seam's callback, signal and video-time accessors (#3835). libobs/obs-source-transition-seam.h declares four more accessors, hidden in libobs like the seam's others, each a single call copied from the line it wraps:

  • obs_source_transition_seam_call_start() / _call_stop(): the type's transition_start (or transition_stop) callback on the context data when it has one, returning whether it had one (obs-source-transition-switch.c.h 186-187, obs-source-transition.c.h 178-179);
  • obs_source_transition_seam_dosignal(): obs_source_dosignal(), both names passed through;
  • obs_source_transition_seam_get_video_time(): obs_video_stats_frame_time(&obs->video.stats). It takes the stats mutex; its callers hold transition_mutex, and the header says so.

No C caller changes. test_source_transition_seam_calls pins them: the accessors are hidden, so it builds the seam (and the load checks transition_valid() asks) into itself over a stand-in core (its signal handler and video stats) and stand-in transitions with counted callbacks, their own signal handler and the private flag. 6 cases: both calls with and without their callbacks, the two signals each dosignal emits (a NULL name skipped, a private transition only on its own handler), and the video time against the frame time.

The transition clock read and stop helpers move to their own file (#3836). The "Extracting a function before porting it" step:

  1. Characterization (test: Characterize the transition clock and stop): test/cmocka/test_source_transition_stop.c, 7 cases through the real libobs (suite graphics, Linux with OpenGL, like the other transition tests): the auto time (1.0 never started, just above 0 early in a long start, 1.0 past a short start's end and while left running); the manual time (0.0 after the start, each snapped manual time, 0.0 again once obs_transition_set() ends it, since it resets the value and keeps the mode); a force stop's callback and stop signals, idle and running, with nothing else changed, only the signals without a callback, nothing on the core's handler for a private transition; and an auto stop rendered directly past its end and one on an output channel (the render thread ends the video, the audio thread the audio): slot B becomes slot A, the video stop and stop signals and the callback once, the old slot A no longer active.
  2. The rename (libobs: Name the transition clock and stop helpers): calc_time, get_video_time, obs_transition_stop and handle_stop lose static and become transition_calc_time, transition_get_video_time, transition_stop and transition_handle_stop, declared in the private header libobs/obs-source-transition-stop.h (hidden), which says which expects transition_mutex held. libobs.pch.h includes it, and it is listed in source-sets.d/LIBOBS_SOURCES.json. The rename is the only edit to the callers; no other function in libobs or rust/ has these names.
  3. The move (libobs: Move the transition clock and stop): the four helpers with obs_transition_get_time() and obs_transition_force_stop() move verbatim into libobs/obs-source-transition-stop.c.h, live C in libobs.core-source after the seam in the group's sorted order, with its own lock_transition / unlock_transition, #undef'd at its end (BUILD.md rule 5). The moved text is byte-identical to the text it replaces (checked with cmp).

RED → GREEN

  • RED commit: 3312c1c (libobs: Stub the transition seam calls): the four accessors declared and stubbed; test_source_transition_seam_calls fails 6/6 (calls_with_callbacks: obs_source_transition_seam_call_start(tr) is not true, ...). The clock and stop move (rust: Port the transition clock read and stop helpers (move them out of obs-source-transition.c) #3836) has no RED commit, by design. coordination.md asks a batch for a RED then GREEN pair per issue, but this issue is testing-policy.md's "Extracting a function before porting it" step: a separate, behaviour-neutral change that moves the functions verbatim, with no Rust and no behaviour change, whose proof is that the unchanged C tests pass. A failing test would need a behaviour change, and the move must not have one. So its proof is the characterization test (passing before the rename, after it and after the move), the byte-identical move, the export sets and the move harness below, as with the earlier transition moves (libobs: Move the transition settings and slots #3537, libobs: Move the transition start and set #3820). Its RED and GREEN come in the port of the new file.
  • GREEN: 88ae773 (libobs: Add the transition seam calls), the stamped head. Runs were on fa0b392cd (on master c37566d), unless noted; the same tree was rebased on master 335f283, then on 19da800 (below).
    • test_source_transition_seam_calls passes 6/6 on the C build (0/6 on the RED commit).
    • The transition tests (ctest -R transition, under Xvfb, TMPDIR unset) pass on all three builds, none skipped: C 28/28, hybrid 33/33, libobs-c-reference 33/33 (rebuilt after the change, its mtime checked). test_source_transition_stop passed 7/7 before the move and after it, and 15/15 repeated runs on the C build.
    • The export sets of the C, hybrid and C reference builds are identical and unchanged (1767). obs_transition_get_time and obs_transition_force_stop stay exported (T); the four renamed helpers and the four seam accessors are local (t).
    • The move checked against master's functions. A scratch harness (not committed) builds master's lines 81-102 and 162-186 of obs-source-transition.c.h with its lock macros, and the new file whole, each as its own program over one logging stand-in for struct obs_source and every call they make (the clock rule with scripted results, the frame-time read, the active-child removal, the release, the signals, the stop callback and each lock, double locks flagged), dumping every field of five sources after each round. The logs of 20,000 rounds of 12 random calls (240,000 calls) are byte-identical under gcc and clang at -O0, at -O2, and at -O1 with ASan and UBSan. All 24 planted mutants are caught: each argument of the clock rule, the frame-time read, each lock, the old child's read, its active check, removal and release, both active flags, both slot writes, the callback check and its argument, each signal name, and the force stop's call.
    • Local gate lanes, before the rebase: --test-diff origin/master (6744 tests passed, 6 skipped, the same on the RED commit), --lane lint, --lane cross, the Windows --all-targets clippy (x86_64-pc-windows-msvc, -D warnings) and the port_comparison bench pass. The cross lane caught one Windows link failure on the first GREEN: the Rust oracle compiles the seam (rust/obs-c-oracle/oracle/source_transition_settings.c), and the MSVC linker keeps the new accessors' reference to libobs's core pointer obs, which no oracle that the obs-data tests link defines. The oracle file now renames it to a pointer of its own (no parity test calls these accessors); that is part of the GREEN commit. After the rebase (runs were on 44a78275b, then stamped as e4a585f, same tree): the transition tests pass again on all three builds, none skipped (C 28/28, hybrid 33/33, libobs-c-reference 33/33); the export sets are still identical (1767); ./unittest passed (Rust 6761 and 912 tests, Tier 2 751/751 on hybrid libobs and libobs-c-reference); the quick ci/ checks, ./lint, --lane lint, --lane cross, the Windows --all-targets clippy and the port_comparison bench pass.
    • The first PR CI run failed the Format checks: ci/test_native_b2_portability.py, which landed on master after this branch's base, pins the evaluated Linux core inventory, and test_source_transition_seam_calls is a core test every host runs. test: Count the seam calls test in the inventory raises its counts by one (418, and 425 with both SDK additions); test_source_transition_stop is a graphics test and does not count. Rebased on master 19da800 (runs were on b06c95e): the check passes; the transition tests pass on all three builds, none skipped (C 28/28, hybrid 33/33, libobs-c-reference 33/33); the export sets are identical (1767); --lane lint, --lane cross and the Windows --all-targets clippy pass. The port_comparison bench test now aborts in its service module on master itself (f96b82e, without this change): filed as bug: obs-c-oracle: port_comparison service bench dereferences its stand-in output #3886, not from this PR.
    • Rebased again on master 20f56eb (runs were on 88ae773): master had rewritten ci/test_native_b2_portability.py to check the inventory's differences and a floor (at least 417) instead of exact counts, so the count commit had nothing left to change and was dropped; the check passes. The transition tests pass on all three builds, none skipped (C 28/28, hybrid 33/33, libobs-c-reference 33/33); the export sets are identical (1767); the quick ci/ checks, ./lint, --lane lint, --lane cross and the Windows --all-targets clippy pass. The port_comparison bench still aborts in its service module, as on master (bug: obs-c-oracle: port_comparison service bench dereferences its stand-in output #3886).
    • Local gate, ci-lint local-gate run: lint, rust-test, cross and Tier 2 on Linux (tier2-linux) passed, and HEAD is stamped (stamped again on 88ae773 after the last rebase, every lane run); the macOS and Windows native lanes do not apply on this host. Its first Tier 2 run failed test_color_correction_16f, which no file here touches; it passed 10/10 alone on the C, hybrid and C reference builds and in the ./unittest Tier 2 run just before, and the gate's rerun passed.
  • Real app (UI, protocol output or logging changes): N/A, no behaviour change.

Checklist

  • Base is master (or the description starts with a Stacked: note)
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits (N/A for docs-only; a focused CI fix may push RED and GREEN together). Here: the stop characterization, the rename and the move (no RED, see above), then the seam accessors' RED and GREEN.
  • User-visible change: its line in docs/features.md is added or updated (not applicable: no user-visible change)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): built with scripting ON (PR CI builds no OBS app: run gh workflow run ci.yml --ref <branch> for the full builds) and cross-checked with clang and MSVC (not applicable)
  • Intentional differences from C listed in the parity test header and rust/README.md (ports) (not applicable: no port)

@rdoupe
rdoupe force-pushed the fix/rust-port-add-the-transition-sea-656 branch from 1688b89 to e4a585f Compare November 7, 2026 09:52
@rdoupe
rdoupe force-pushed the fix/rust-port-add-the-transition-sea-656 branch from e4a585f to b06c95e Compare November 7, 2026 11:20
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In progress in obs-rust Multiview Nov 7, 2026
@rdoupe
rdoupe marked this pull request as ready for review November 7, 2026 11:49
@rdoupe
rdoupe requested a review from zackees as a code owner November 7, 2026 11:49
@rdoupe
rdoupe added this pull request to the merge queue Nov 7, 2026
@rdoupe

rdoupe commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator Author

Handed off to the coordinator

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 7, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Needs fix in obs-rust Multiview Nov 7, 2026
Characterization before the clock read and stop helpers of
obs-source-transition.c (calc_time(), get_video_time(),
obs_transition_get_time(), obs_transition_stop(), handle_stop() and
obs_transition_force_stop()) move to their own file and are ported.
The source_transition_clock parity tests pin the time rule on plain
values; nothing pinned the time through the real video clock, what a
force stop calls and signals, or the slots after a stop.

test_source_transition_stop creates transitions through the real
libobs, with a transition type that counts its transition_stop
callback. 7 cases pin:
- the auto time: 1.0 never started, just above 0 early in a long
  start, 1.0 past a short start's end and while left running;
- the manual time: 0.0 after the start, the manual time each tick
  snaps to, and 0.0 again once obs_transition_set() ends it;
- a force stop: the callback and the stop signals, idle or running,
  nothing else changed; only the signals without a callback; nothing
  on the core's handler for a private transition;
- an auto stop rendered directly past the end, and one on an output
  channel: slot B becomes slot A, the video stop and stop signals and
  the callback once, and the old slot A no longer active.

Transitions need core video, so it builds on Linux only and runs under
xvfb-run; without a display the cases skip.

Refs #3836.
calc_time(), get_video_time(), obs_transition_stop() and handle_stop()
lose `static` (and `inline`) and take transition_-prefixed names,
transition_calc_time(), transition_get_video_time(), transition_stop()
and transition_handle_stop(), so the transition renders can still call
them once they move out of obs-source-transition.c with
obs_transition_get_time() and obs_transition_force_stop(). Their bodies
are unchanged, and the rename is the only edit to their callers.

obs-source-transition-stop.h declares them, hidden in libobs (not
EXPORT), and says which expects transition_mutex held: all but
transition_handle_stop(), called after it is let go. libobs.pch.h
includes it with the other transition headers. No other function of
libobs or rust/ has these names; transition_stop is otherwise a signal
name and an obs_source_info member.

Refs #3836.
transition_calc_time(), transition_get_video_time(),
obs_transition_get_time(), transition_stop(), transition_handle_stop()
and obs_transition_force_stop() move verbatim from
obs-source-transition.c into obs-source-transition-stop.c, ahead of
their port to rust/obs-source-seam. The renders that call the four
helpers stay behind and reach them through
obs-source-transition-stop.h. The file has its own copy of
lock_transition() and unlock_transition(), #undef'd at its end
(BUILD.md), and is live C in libobs.core-source, after the seam in
the group's sorted order.

No behaviour change: the moved text is byte-identical to the text it
replaces, and the export sets of the C, hybrid and C reference builds
are unchanged, with the four helpers local.

Refs #3836.
The transition seam gets four accessors that the ports of the
transition start and set and of the clock read and stop will call in
place of the lines they wrap: obs_source_transition_seam_call_start()
and _call_stop() (the type's transition_start or transition_stop
callback, when it has one, and whether it had one),
obs_source_transition_seam_dosignal() (obs_source_dosignal()) and
obs_source_transition_seam_get_video_time() (the latest video frame's
time). obs-source-transition-seam.h declares them, hidden in libobs
like the seam's other accessors; here they are stubs that call and
return nothing.

test_source_transition_seam_calls pins them. They are hidden, so it
builds the seam and the load checks into itself and runs them on a
stand-in core (its signal handler and video stats) and stand-in
transitions with counted callbacks, their own signal handler and the
private flag. 6 cases: both calls with and without their callbacks,
the two signals each dosignal emits (a NULL name skipped, a private
transition only on its own handler), and the video time against the
frame time. All 6 fail on the stubs.

Refs #3835.
The four transition seam accessors get their bodies, each a single
call copied from the line it wraps:
- obs_source_transition_seam_call_start() and _call_stop() call the
  type's transition_start (or transition_stop) on the context data
  when it is set, as obs_transition_start() and handle_stop() do, and
  return whether it was;
- obs_source_transition_seam_dosignal() calls obs_source_dosignal()
  with both names as given;
- obs_source_transition_seam_get_video_time() returns
  obs_video_stats_frame_time(&obs->video.stats), as
  transition_get_video_time() reads it.

The Rust oracle compiles the seam
(rust/obs-c-oracle/oracle/source_transition_settings.c), and nothing
there defines libobs's core pointer, obs, that the new accessors read:
the MSVC linker keeps that reference and fails the obs-data tests. The
file now renames obs to a pointer of its own; no parity test calls
these accessors.

No C caller changes: the transition code keeps its direct calls until
the ports replace them. test_source_transition_seam_calls passes 6/6,
and the export sets of the C, hybrid and C reference builds are
unchanged, with the accessors local.

Fixes #3835.
Fixes #3836.

Local-Gate: v1 tree=09c80cbac853745f57f2cecd86834a47312576c4 secs=2301 lanes=lint:run,dylint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1794135007,"gate":"rust/all/fmt","host":"linux-x86_64","key":"b158899e0204e4227bb47875ccaae3ac5af71324f8b64bb1a836dcb17fd34b22","lane":"lint","parents":["3312c1ceeb9830ac1f6d615b26076f3d64b9579f"],"secs":49,"stamp":"0c37d7dba93e613c9aebbaf0dbc8ac74","tree":"09c80cbac853745f57f2cecd86834a47312576c4","v":1,"via":"run"}
Ci-Attestation: {"at":1794135007,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"b158899e0204e4227bb47875ccaae3ac5af71324f8b64bb1a836dcb17fd34b22","lane":"lint","parents":["3312c1ceeb9830ac1f6d615b26076f3d64b9579f"],"secs":49,"stamp":"7b028504a07fe3c925f0a711f2bed1e8","tree":"09c80cbac853745f57f2cecd86834a47312576c4","v":1,"via":"run"}
Ci-Attestation: {"at":1794135007,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"7796e1570a4d670208e59698eaf796427e3cef17da795ed02a2f6fa77eb5c513","lane":"rust-test","parents":["3312c1ceeb9830ac1f6d615b26076f3d64b9579f"],"secs":215,"stamp":"9dc459bf54ad1ffa259062f02b319d50","tree":"09c80cbac853745f57f2cecd86834a47312576c4","v":1,"via":"run"}
Ci-Attestation: {"at":1794135007,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"e0acbd54382ca41a8d0916cd05b58bfb8f3da14c51765dc827b28e8403a2102f","lane":"cross","parents":["3312c1ceeb9830ac1f6d615b26076f3d64b9579f"],"secs":35,"stamp":"6df4e15eb9fc440f19235e3cfe69c657","tree":"09c80cbac853745f57f2cecd86834a47312576c4","v":1,"via":"run"}
Ci-Attestation: {"at":1794135007,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"e0acbd54382ca41a8d0916cd05b58bfb8f3da14c51765dc827b28e8403a2102f","lane":"cross","parents":["3312c1ceeb9830ac1f6d615b26076f3d64b9579f"],"secs":35,"stamp":"bd48ceef9374aa73cab2ec8a16936b05","tree":"09c80cbac853745f57f2cecd86834a47312576c4","v":1,"via":"run"}
Ci-Attestation: {"at":1794135007,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"e0acbd54382ca41a8d0916cd05b58bfb8f3da14c51765dc827b28e8403a2102f","lane":"cross","parents":["3312c1ceeb9830ac1f6d615b26076f3d64b9579f"],"secs":35,"stamp":"7ae57c56093071539a170f684000083b","tree":"09c80cbac853745f57f2cecd86834a47312576c4","v":1,"via":"run"}
Ci-Attestation: {"at":1794135007,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"e0acbd54382ca41a8d0916cd05b58bfb8f3da14c51765dc827b28e8403a2102f","lane":"cross","parents":["3312c1ceeb9830ac1f6d615b26076f3d64b9579f"],"secs":35,"stamp":"3966984814881f3ee3bd69449b5e6650","tree":"09c80cbac853745f57f2cecd86834a47312576c4","v":1,"via":"run"}
Ci-Attestation: {"at":1794135007,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"5b8cd54c75d0564575c11d9a30951c5345d08dfd74c92dc4c4f6718cae6a5a30","lane":"tier2-linux","parents":["3312c1ceeb9830ac1f6d615b26076f3d64b9579f"],"secs":2300,"stamp":"9fffd7e42e11d94322e5d5425956e37f","tree":"09c80cbac853745f57f2cecd86834a47312576c4","v":1,"via":"run"}
@rdoupe
rdoupe force-pushed the fix/rust-port-add-the-transition-sea-656 branch from b06c95e to 88ae773 Compare November 8, 2026 10:50
@rdoupe
rdoupe added this pull request to the merge queue Nov 8, 2026
@rdoupe

rdoupe commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

Handed off to the coordinator

Merged via the queue into master with commit 253ae31 Nov 8, 2026
74 of 76 checks passed
@rdoupe
rdoupe deleted the fix/rust-port-add-the-transition-sea-656 branch November 8, 2026 11:29
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to Done in obs-rust Multiview Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

1 participant