AVPlumber · Mixer cookbook

2. Read raw inputs into pinned memory once

Direct uploads remove CPU copies and upload threads. Resident looped files also remove repeated reads, at an explicit pinned-RAM cost.

Reviewed 15 October 2026 against e72ff8b4. These pages describe that code and named workload settings; they do not assert what every deployment runs.

Choose the mode for the input

Mode Work avoided Scope
hwupload Baseline FFmpeg path Generic parser default
direct Read into pinned staging memory; no separate raw upload node/thread Raw-file path
resident Direct upload plus retained file contents in pinned host memory L4 profile; looped NV12/P010 files
pinned Patched FFmpeg pinned upload path Alternative filter path

Resident mode fills each file-backed frame on first use and reuses the pinned host bytes on subsequent loops; file changes are checked at the loop boundary. Each source still transfers every displayed frame to the GPU on its own cadence. This does not cache a GPU texture to fake independent live inputs.

The raw uploader uses a private stream and waits for its transfer before handing the frame on. raw_pool_frames=10 in the L4 profile bounds its GPU-frame pool; it is independent of the browser ring and the size of the resident file contents.

Costs and measured benefit

Pinned host memory cannot be swapped out. The historical 47 two-second clips used roughly 8.8 GB. Resident files are a useful benchmark model for capture writing into pinned memory, but do not make arbitrary live input I/O free.

The earlier direct-upload change reduced mixer CPU from 679 to 510% of one core and removed 141 threads. The later resident-file change reduced the historical input-reading group from 139.7 to 27.3%. These are different steps in the 192-source experiment. Original direct-upload measurements · resident-file measurements.

Verify

Check pinned host memory and GPU-pool high-water marks, file-change handling, cadence across loop boundaries and pixel correctness for each storage format. Keep v210's distinct unpack/upload path in the comparison instead of assuming NV12 results apply.

Implementation at the reviewed revision