Repository navigation
Conversation
|
This probably needs more work, but I'd love some feedback on it. |
srperens
left a comment
There was a problem hiding this comment.
Verdict: Request changes. The design and the probe hygiene hold up. But the test that guards the core claim, that the cut lands on the cut point's frame, cannot run in this repo's CI. It still could not after #810 lands, which the body relies on.
Requested changes
- Make
stinger_web_testrun in CI. It skips wherever cefsrc is missing (backend/tests/stinger_web_test.rs:51—fn cefsrc_available() -> bool {), and no job here has cefsrc. #810's newTest (Linux, cefsrc)job runs onlycargo test --package strom --test cefsrc_test, and its change detection matches onlybackend/tests/cefsrc_test.rsand the CEF build paths. So after #810, this file would still never execute. CLAUDE.md: "Tests that skip on a missing element pass green and guard nothing … add the missing package in the same PR." The smallest fix: once #810 lands, add--test stinger_web_testto that job andbackend/tests/stinger_web_test\.rsto its path filter, then putci:cefon this PR. - Re-run
Check (Linux)(gh run rerun 37818021904 --failed). It failed onanother_format_after_a_prores_clip_still_airs(left: 29 right: 30,frames_late: 0). The same test failed the same way on #1036, which does not touch the stinger, so I do not attribute it to this diff. The failure left thestrom-typesand frontend steps unrun.
Claims
| Claim | Verdict | Evidence |
|---|---|---|
| The per-take probe follows the BUFFER-probe rules | CONFIRMED |
See Probe below |
| A take in flight does not keep a stopped flow alive | CONFIRMED |
backend/src/stinger/web.rs:215 — pad: gst::glib::WeakRef<gst::Pad>,. The orchestrator does hold a strong cefsrc (backend/src/state/stinger/web.rs:211 — .cloned()), but in a task-local that drops when the take returns, not in a signal closure |
| A dropped request still frees the mixer | CONFIRMED |
backend/src/state/stinger.rs:993 — tokio::spawn(async move { detaches the take from the request; the claim is keyed by (flow_id, block) |
| The cut lands on frame 15 for a page take | UNVERIFIED |
Only the author's Linux Docker rig, before the rebase. Not re-run since, and never in this repo's CI (change 1) |
Probe. backend/src/stinger/web.rs:253 — let probe = pad.add_probe(gst::PadProbeType::BUFFER, move |_, info| {. It uses relaxed atomics and a memory-pointer compare, with no lock, allocation or formatting. It is removed when WebAnchor drops, at most about 600 ms after the trigger.
Overlaps.
- #810 owns the CI job that would make change 1 possible. Land it first, then extend it here.
- #809 owns the CPU mixer's premultiplied path. The body's open question ("route them through #809's unpremultiply, or keep page stingers GPU-only?") is the maintainer's to answer there. Merging this first ships page stingers with dark edges on CPU mixers.
Radius. SHARED: the take path in state/stinger.rs and effects/stinger.rs is shared with clip takes. The StingerState API gains source_kind, which has a ToSchema derive. openapi.json is updated, and API Contract Check is green.
Tests & CI. At 6322679, both Linux builds, WASM, API Contract and Static JS are green, and Check (Linux) is red (change 2). stinger_page_api_test needs no cefsrc, so it should run once the job is re-run.
Confidence: HIGH
|
Written by Claude (AI) on behalf of @wagenet. @srperens, on your review:
Still open for the maintainer: the CPU mixer's premultiplied path (#809), and whether #810 or this PR lands first. |
|
Since this PR was opened, main gained shared test setup in This PR adds two more copies of the
Both match
The stinger harness in This does not block the PR: the code compiles and merges cleanly against main as it is. Please fold it in on your next rebase. Posted by Claude (AI) for the maintainers. |
6322679 to
c772ba8
Compare
|
Written by Claude (AI) on behalf of @wagenet. @srperens, update:
|
srperens
left a comment
There was a problem hiding this comment.
Area: Vision mixer stingers, HTML Input page source (shared take path)
Adds HTML Input pages as a stinger source. A take raises the fill, triggers the page with #strom-take-<id>, finds the page's first new frame with a per-take BUFFER probe, then plans the take on the mixer grid. The approach looks right. The probe has no lock or allocation, holds the pad through a WeakRef (backend/src/stinger/web.rs:215) and is removed on drop (:337-342).
Since the last review: rebase, plus common::state::new() in both tests (c772ba8). Check (Linux) is green now, so my earlier point 2 is resolved. stinger_page_api_test runs there under cargo test --package strom.
Neighbours: #810's cefsrc job still runs only --test cefsrc_test, and its path filter matches only cefsrc_test.rs. The follow-up in the body is still needed: land #810 first, then extend that job here. #809 is still the answer to the CPU-mixer premultiplied question. #974 touches cef_pages.rs but not load_url or shown_url, so I found no conflict.
- Every cut-frame claim, and the dropped-request guard, still rests on a manual rig run. All 5
stinger_web_testtests return early without cefsrc (backend/tests/stinger_web_test.rs:48). - The rebase moved the panel version backwards (see inline).
| </div> | ||
| <span class="status-text" id="statusText">Connecting...</span> | ||
| <span class="shortcut-hint">v2.48-take-note | 1-9,0 = PVW | Space = AUTO | X = CUT | F = FTB | M = Hide</span> | ||
| <span class="shortcut-hint">v2.47-stinger | 1-9,0 = PVW | Space = AUTO | X = CUT | F = FTB | M = Hide</span> |
There was a problem hiding this comment.
The rebase moved the version backwards. main shows v2.48-take-note (#803), and this line replaces it with v2.47-stinger. CLAUDE.md says to bump the version after static changes "so the browser-loaded version can be verified". With this, a browser on this build shows a lower version than one on main. Make it v2.49-….
| let state = self.clone(); | ||
| let (flow_id, block) = (*flow_id, block.to_string()); | ||
| let expected_file = expected_file.map(str::to_string); | ||
| tokio::spawn(async move { |
There was a problem hiding this comment.
This spawn now carries every take, clip takes included, so it is shared behaviour. Its only guard is a_dropped_take_request_still_frees_the_mixer in stinger_web_test.rs:484, which skips without cefsrc and so never runs in CI. Reverting this spawn stays green. A clip version could go in stinger_test, which Check (Linux) runs: time out stinger_take during its preroll, then assert that StingerCompleted arrives and the mixer is free. That guard would run now, without waiting for #810. Not verified that a clip take's preroll is long enough for a reliable timeout.
There was a problem hiding this comment.
Written by Claude (AI) on behalf of @wagenet.
Added a clip version in d0ceaa1, in stinger_test: a_dropped_take_request_still_frees_the_mixer. It drops a take of an uncued clip after 1 ms (the cue is still running, so the timeout fires), waits for StingerCompleted, checks the mixer is free, and runs a second take. Passes on macOS locally (3 s). With the spawn in stinger_take replaced by a direct await, it fails with "the dropped take never finished". Check (Linux) will be the first run on Linux.
srperens
left a comment
There was a problem hiding this comment.
Area: Vision mixer stingers, HTML Input page source (shared take path)
Since the last review there is one new commit, d0ceaa1. It adds a clip version of the dropped-request test and bumps the panel version. The approach still looks right; neighbours (#810, #809, #974) are unchanged.
Resolved:
- Panel version: It is now
v2.49-stinger(backend/static/vision-mixer.html:1388), above main'sv2.48-take-note. - Dropped-request guard: It now runs in CI.
a_dropped_take_request_still_frees_the_mixer(backend/tests/stinger_test.rs:468) calls the realstinger_takeand drops it after 1 ms while it cues.- With the
tokio::spawninstinger_take(backend/src/state/stinger.rs:993), the take still finishes. - Revert the spawn and the dropped future leaves
runningclaimed with nothing to release it, so noStingerCompletedarrives and the test panics at:495. That is a real guard. - It needs only
CODEC_ELEMENTS; in Check (Linux) it ran for about 2.8 s, so it was not skipped.
- With the
Still open:
- The page cut-frame claims still rest on the manual rig run. All 5
stinger_web_testtests finished in 0.02 s in Check (Linux) (backend/tests/stinger_web_test.rs:48). The follow-up after #810 is still needed.
d0ceaa1 to
4be39e2
Compare
4be39e2 to
3e235cc
Compare
A clip take knows where its first frame lands before it starts: the Media Player pins it. A source that starts on a trigger only says when it started afterwards, so its take is programmed late, with the graphic pad already up. - `PipelineManager::raise_stinger_fill` stages the pads as a take does and raises the graphic pad. `program_stinger` with `StingerTake::fill_raised` skips the staging and keeps the pad up until the take's end. - `stinger_take_claimed` builds its take with `take_on_grid` and hands it to `announce_stinger_take`, which reports and finishes any take. The re-park after a take is skipped when there is no clip to park. The clip path does the same thing in the same order as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A page starts its animation on a trigger, and Chromium paints its first frame some time later. `stinger::web` holds what a page take needs to time itself from that frame: - `WebAnchor`: a probe on the page's cefsrc output that records the first frame of new content after the take. A GAP repeat, or a fixed-rate gstcefsrc re-sending its frame, shares the previous buffer's memory and does not count. Atomics only, removed once the take is planned. - `web_stinger_start`: the first frame if it came within 100 ms of the take, otherwise the take plus the plugin's delivery delay: 30 ms on the fixed-rate production gstcefsrc (measured on cefsrc's own output), 20 ms on one that emits as it paints. - `web_first_output_frame`: the output frame that page frame first goes on air in. The mixer drops queued buffers that end before an output frame and takes the oldest left, so a page at or below the mixer's rate is on air in the frame its timestamp falls in, and a faster one from the next frame boundary. Neither is the nearest frame: cefsrc's phase against the mixer's grid is fixed per run, and nearest is a frame out whenever that phase is in the second half of a frame. - `WebStingerSettings`: duration, cut point and mix from the HTML Input block. A cut point earlier than the grace period plus two frames (167 ms at 30 fps) cannot be programmed in time and is refused, as is one at or past the end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An HTML Input in stinger mode on the mixer's stinger input is a page stinger. Its settings are properties of the block, and it is the one entry of its library. A take raises the graphic pad (the page is transparent at rest), triggers the page by setting its URL fragment to #strom-take-<id> through `cef_pages::load_url`, waits for the page's first frame, and programs the take from the output frame that frame goes on air in. Reporting and finishing are a clip take's: StingerStarted, StingerCompleted, StingerFailed and the take report. A take that cannot program cuts instead, as a clip take does. The graphic pad goes up before the trigger because the take is programmed after the page has started: a fill keyframe at the page's start would already be behind the mixer, and the page's first frame would not show. - A page is a classic stinger with premultiplied alpha: the GPU mixer blends it correctly, the software mixer warns that edges come out dark. - On a gstcefsrc that emits only as the page paints, the take warns: the stinger pads let a held frame go after two frames. - Under remote control the trigger loads asynchronously; the take still anchors on the first frame, and logs that the fallback may be late. - Library operations (add, remove, settings, examples) are refused for a page, so a page cannot ask for a matte variant. Cue is a no-op. - The take report expects the page frames from when its frame count starts, which is after the page's first frame has reached the mixer. `StingerState` gains `source_kind`, so a client can tell a clip library from a page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The HTML Input block gains Stinger Page, Stinger Duration, Stinger Cut Point and Stinger Mix. The vision mixer panel shows a page source as its one entry, hides the clip tools for it, and stops polling for an analysis a page never gets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gated by STROM_REQUIRE_CEF and run on Linux only, each over STINGER_WEB_TAKES takes (default 10), with live sources on the mixer: - the program cuts 15 frames (500 ms) after the page's first frame on air: on the software mixer, on the GPU mixer, and for a 60 fps page on a 30 fps mixer, whose takes start on both halves of an output frame; - every page frame of a take reaches the mixer in time; - a page that opens on 300 ms of unchanged pixels is timed from the take, and cuts within two frames of 500 ms by its own clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A take claims the mixer, and only its own ending releases the claim. A page take waits for the page between the two, so a request dropped then (the client went away, a proxy timed out) left the mixer claimed: every later stinger and every cut was refused until the flow restarted, with the graphic pad up. The take now runs in a task of its own that the request awaits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A page URL with a fragment of its own is refused: the take replaces the fragment, which moves a page that routes by it off its route. - On a gstcefsrc that sends only paints, the first buffer after the take is the page's start. It was spent as the baseline instead, which put every cut a frame late after a 100 ms wait for a buffer that never comes. - A page that paints while at rest is noticed before the take and warned about: its first frame after the take can be a paint of its rest state, which puts the cut a frame or two early. The block's help says a stinger page must stop drawing at rest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A take waits for one frame from a fixed-rate gstcefsrc again, not two, which cost about a page frame on every take. - "A buffer with nothing before it is new" applies to a paint-only gstcefsrc only. On a fixed-rate one that sent nothing until the take, its first buffer is a repeat of the rest frame, and counting it as the page's start put the cut a frame or two early. - Whether a page paints at rest is judged after the take instead. The probe stays on and counts the page's new frames from a page frame past its duration until the earliest the next take could trigger it (the mixer's latency past the take's finish point). Two or more warn; one is the page clearing itself as it ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The URL check covered only the URL stored on the block. A page moved live through the element endpoint or MCP to a URL with a fragment still lost it to the take. The take now checks the URL the page shows, which is what it rewrites. A take's own fragment from an earlier take is accepted, and surrounding space is trimmed first, as it is before the page loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The check guessed when the next take could start, and a take chained straight after the last one beat the guess, so a well-behaved page was warned about. For a log line, that is not worth a probe that outlives the take and a mixer latency query. The block's help says a stinger page must stop drawing at rest; a page that does not cuts a frame or two early. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A page is the library's one entry (classic, premultiplied, its cut point), cueing it succeeds and does nothing, the clip-library operations are refused with the reason, and a page URL with a #fragment of its own is reported. Runs without cefsrc, so CI runs it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…panel version A clip take dropped while it cues still completes and frees the mixer. This runs in stinger_test, which Check (Linux) runs, so the spawn in stinger_take no longer rests on the cefsrc-only page test. The rebase had moved the vision mixer panel version back to v2.47; main is at v2.48, so this is v2.49. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
3e235cc to
3bc8f2c
Compare
The committed snapshot listed the null variant of source_kind first. The generated spec lists it last, so openapi_spec_snapshot failed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
stinger_page_api_test and stinger_web_test sat in backend/tests/ with no target, so they were never built and test_layout_test failed. Neither changes process-global state, so they join tests/it/. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Written by Claude (AI) at @wagenet's request. Replaces #1020, which closed when its base #1010 merged; the same commits rebased onto
main.Refs #1010, #1020
Problem
#1010 plays stingers from clips only. A stinger is the graphic that covers the frame while the program switches beneath it. Many stinger graphics are made as web pages, and Strom already renders pages through the HTML Input block. A clip take pins its first frame in advance. A page starts on a trigger, and Chromium paints its first frame some time after that, so the take cannot be planned before it starts.
Change
An HTML Input with Stinger Page on, wired to the mixer's stinger input, is a stinger source. Duration, cut point and mix are properties on the block. A take works in four steps:
#strom-take-<id>throughcef_pages::load_url. The page starts onhashchange.The page plays as classic premultiplied: the GPU mixer blends it correctly, and the CPU mixer warns about dark edges, as #1010 already does.
The seam is 9eec633. The take can start with the fill pad already up (
raise_stinger_fill,StingerTake::fill_raised), andstinger_take_claimedis split intotake_on_gridandannounce_stinger_take. The clip path is unchanged.Rebased onto #1010's final form.
program_stingerkeeps #1010's checks-then-abort shape; the staging (resting state and graphic pad set-up) moves intostage_stinger_pads, whichraise_stinger_fillshares.raise_stinger_fillreturnsStingerProgramErrorand aborts a half-staged take itself, likeprogram_stinger. A page take that fails after it ended a fade-to-black now broadcasts the fade's end, as a clip take does.take_on_gridplaces the take with #1010'stake_times, so a page's mix is clamped to end with the page too. The page's frame interval feeds #1010's cut-frame check.Which output frame a page frame lands on. The mixer drops queued buffers that end before an output frame and takes the oldest one left. So a page at or below the mixer's rate is on air in the frame its timestamp falls in, and a faster page from the next frame boundary. I rejected rounding to the nearest frame. cefsrc's phase against the mixer grid is fixed per process, and the nearest frame was one frame out in every run whose phase fell in the second half of a frame.
Also in this PR:
#fragmentof its own is refused, on the stored URL and on the one the page shows. The take's own fragment is accepted.StingerStategainssource_kind(clips or page).openapi.jsonis updated.Evidence
Measured on Linux arm64 Docker with the production gstcefsrc pin (b633408, fixed rate), software CEF, and live sources on both mixer inputs. GPU runs used GLX/llvmpipe on Xvfb. The test page counts frames from its first frame on air to the cut.
a_dropped_take_request_still_frees_the_mixer. Reverted: "the dropped take never finished".#fragmentURLs, paint-only first framestinger::web, each failing when reverted.stinger_page_api_test, no cefsrc needed. Reverting the source kind, the cue or the refusal each fails it.stinger_test,stinger_clip_testandstinger_api_testpass.Tests
stinger_test,stinger_clip_test,stinger_api_test,stinger_page_api_test,openapi_test, and thestingerlib unit tests. All pass.cargo clippy --all-targets -D warningsis clean.stinger_web_test, all 5 tests, withSTROM_REQUIRE_CEF=1andSTROM_REQUIRE_GL=1.STROM_REQUIRE_CEF=1,STROM_REQUIRE_GL=1, Xvfb):stinger_web_test, all 5 pass. The CPU 30 fps, CPU 60 fps and GPU takes each cut on frame 15 in 10 of 10 takes, with no late frames. A first run on a heavily loaded host (load average above 100) also cut on frame 15 but failed the no-late-frames assertion, so it was repeated on a quiet host.main. Windows failed two of feat(vision-mixer): stinger transitions: classic, track matte and mask only #1010's clip tests in 1 of 4 runs; feat(vision-mixer): stinger transitions: classic, track matte and mask only #1010's own head passed 3 of 3.stinger_web_testreturns early on macOS (CEF needs a Cocoa run loop) and wherever cefsrc is missing. CI has no cefsrc, so it skips there and guards nothing today. ci(cefsrc): run tests against a real cefsrc #810 adds a cefsrc job, but that job runs onlycefsrc_test, so even after ci(cefsrc): run tests against a real cefsrc #810 lands this file will not run. This PR needs a follow-up edit once ci(cefsrc): run tests against a real cefsrc #810 merges: add--test stinger_web_testto that job and the test file to its path filter, then label the PRci:cef. Until then the cut-frame claims rest on the Linux Docker rig run above, which is a manual run.For the reviewer
Out of scope
🤖 Generated with Claude Code