Repository navigation
Description
Summary
What is left of #682. The convention (a block emits its native memory type, and the consumer adapts) is written down in docs/BLOCK_GUIDELINES.md, and gst::video_adapt::decide() holds the adapter rules. Three things still decide the memory format somewhere other than the consumer's view of its negotiated caps.
1. The global VideoConvertMode
gpu::detect_gpu_capabilities() picks one converter for the whole process at startup: autovideoconvert when NVENC and CUDA-GL interop are present, plain videoconvert otherwise. Call sites on main:
videoenc.rsandvideoformat.rs: the block's input frontndi.rs: four call sitesdevicesrc.rsvision_mixer/builder/pipeline_cpu.rs
The choice belongs to each link, not to the process. Today it mostly works because the linker's GL-download retry (#802) catches a refused GL link. That retry only fires on a format refusal, though. A videoconvert with video/x-raw(ANY) templates accepts GL memory and passes it on, so the dead end appears one element further down. BLOCK_GUIDELINES also says to avoid autovideoconvert in new code. The NVIDIA branch still hands it to every one of these blocks.
Direction: give each call site an input front that decides from the negotiated caps through decide(), extending decide() where it does not yet cover a case. Retire VideoConvertMode once no call site is left. Threading (gpu::configure_video_convert, n-threads) stays on the converter a site ends up with. One block per PR.
2. WHIP Input's unconstrained videoconvert
whip.rs builds a videoconvert per video slot between decodebin and the output tee, with no capsfilter after it. It negotiates passthrough, so it does no useful work. When it does convert, it does so silently on the CPU, frame by frame. Test whether it can be removed across real flows: WHIP to Vision Mixer on GL, WHIP to Video Encoder to WHEP, WHIP to recorder, WHIP to thumbnail. The audio branch's audioconvert and audioresample raise the same question at lower stakes.
3. gl_output (Compositor) and gl_download (Vision Mixer)
These are producer-side switches that make the operator guess what is downstream. They are the same decision with opposite polarity. Since #802 a consumer adapts to GL memory without them. Compositor is deprecated, so only Vision Mixer matters. Hide the property from the block definition but keep tolerating it in stored flows (the parser falls back to the default), or keep it only as a diagnostics override. Check whether block property schemas are part of the OpenAPI snapshot before removing it.
Tests
Each converted block gets a guard test that builds the block and links it behind a video/x-raw(memory:GLMemory) producer, and that fails if the caps-aware front is reverted. The GL elements the test needs must be in the CI package list (.github/workflows/ci.yml).
Related
- Standardise on consumer-side memory-format adaptation (GL/system) between blocks #682: the convention, closed
- refactor(gst): decide video input adapters in one place, and write down the block contract #951:
decide()and the block contract - fix(gst): download GL memory where a consumer cannot take it #802: the linker's GL-download retry
Activity
wagenet commentedon Oct 6, 2026
Another trigger for item 1, this time with a race that makes it intermittent.
Setup: macOS, GStreamer 1.28.6, Strom 68632494. An MPEG-TS/SRT Input receives H.264 (1280x720) and AAC from an SRT caller. A recorder is set to transcode on that input.
What happens: about 2 s after the caller's first data, srtsrc stops with
streaming stopped, reason not-negotiated (-4). The input's picture freezes downstream. The input's audio recorder links, but its video recorder never does.Why (GST_DEBUG
decodebin:6,vtdec:5,basetransform:5):vtdechwand calls autoplug-query for its pad before that pad is linked to anything. With nothing downstream constraining it, vtdec negotiatesvideo/x-raw(memory:GLMemory), format=NV12.videoconvert. It accepts the GLMemory caps (accept-caps result: 1).videoconvertthen can't find a peer for them:FAILED to get peer of <…venc…:videoconvert:src> to accept video/x-raw(memory:GLMemory). Next comescould not send sticky eventson the recorder's queue, thenvtdec.c:499 pausing output task because of downstream: not-negotiated.The mixer branch takes GLMemory, so only the recorder branch refuses. The refusal comes after linking, so the #802 GL-download retry never fires.
Why it's intermittent: it fails only when vtdec negotiates before decodebin exposes and links its pad. When the pad links first, the caps query reaches the encoder and vtdec picks system memory. Every test fed real H.264 at 20 and 30 fps, with and without B-frames, and every caller start-up pacing tried failed. One 30 fps B-frame clip passed twice. Turning recording off for the input avoids it, and the input then survives caller reconnects.
Directions: the item 1 fix (a caps-aware input front on
videoenc.rs) would cover this. Separately, the input block could answer decodebin's autoplug-query from its real downstream, so the decoder can't pick a memory type before it's linked.Posted by Claude (Claude Code) on Peter's behalf.
fix(vision mixer): adapt GPU inputs to any pixel format, converting o…
srperens commentedon Oct 19, 2026
Area: Video memory formats, consumer-side adaptation
About: Three things still choose a memory format away from the consumer's negotiated caps: the process-wide
VideoConvertMode, WHIP Input's unconstrainedvideoconvert, and Vision Mixer'sgl_download. Comments add a macOSnot-negotiatedrace the #802 retry misses.Relates to: #1021 (open; item 1, Video Encoder only). #1091 (open; Media Player refuses GL at its clip appsink, since a GL context cannot cross pipelines; the author asks to keep it). #1099 (the same cross-pipeline GL problem as an issue). #747 (open; grows the global mode this retires). #1085 (open; WHEP Input passes decoder memory through, the stance item 2 asks of WHIP Input). Merged #1093, #1033, #802, #951; closed #682.
Thoughts: One block per PR, as the issue says. Treat cross-pipeline bridges (#1091, #1099) as a separate case from the producer-side choices listed here.
wagenet commentedon Oct 21, 2026
Posted by Claude on behalf of the author.
PR #1091 adds one justified producer-side memory choice: the Media Player's clip video appsink refuses GL memory (it accepts CUDA, D3D and system memory). The consumer cannot adapt GL there: caps queries stop at the appsink/appsrc boundary, and a GL context does not show in caps.
gluploadpasses GL memory through when contexts can share, butglcolorconvertneeds the very same context, which the player's pipeline never has in common with the flow's. Please do not retire it as a producer-side choice when working through this list.srperens commentedon Oct 27, 2026
The Video Encoder case is released in v0.7.2: #1111 (fix(videoenc): adapt the input memory to what the encoder takes) puts a caps-aware input front, using
video_adapt::decide(), on the encoder in place ofVideoConvertMode.Still open here:
VideoConvertModein Local Input (devicesrc), Video Format and NDI,videoconvert,gl_download.🤖 Generated with Claude Code
feat(videoformat): scale GPU memory on the GPU
test(videoformat): run the GL tests one at a time
fix(scale_front): download first when the GPU scaler cannot take the …
fix(whip input): name the slot and caps when the decoder cannot link;…
fix(local input): correct the capture-front comments; check height an…
feat(videoformat): scale video where it is, GPU memory on the GPU (#1117
fix(vision mixer): emit GL memory and retire gl_download (#1119)
fix(vision mixer): download GPU memory on the CPU mixer's own inputs (#…
fix(whip input): emit the decoder's video without a converter
fix(whip input): name the slot and caps when the decoder cannot link;…
8 remaining items
fix(whip input): emit the decoder's video without a converter
fix(whip input): name the slot and caps when the decoder cannot link;…
refactor(video adapt): decide scaling in decide(), not in scale_front
test(ndi): guard that NDI Input emits its video without a converter
fix(whip input): emit the decoder's video without a converter (#1128)
fix(compositor): download GPU memory on the CPU backend's own inputs (#…
refactor(video adapt): one planner: scaling, downloads and pins from …
fix(ndi): adapt NDI Output's video input; emit NDI Input's video as i…
fix(local input): emit video as the source delivers it (#1129)
refactor(gpu): retire the global VideoConvertMode
fix(gpu): keep the WSL skip and the macOS thread log; drop stale mode…
docs(gpu): say where CUDA-GL interop fails on WSL2 now that nothing f…
refactor(gpu): retire the global VideoConvertMode (Eyevinn#1142)
docs: lessons go into the repo, not into an agent's local memory (#1235)