@@ -351,12 +351,63 @@ Where the implementation differs from the plan above:
351351 ` write ` matches NVENC's pitch (safe only for 64-aligned widths; we warn otherwise);
352352 (3) forced-IDR via ` picture_type ` with picture-type-decision enabled.
353353
354+ ### VAAPI removed (cros-codecs is not buildable on modern libva)
355+
356+ The VAAPI backend (added behind the ` vaapi ` feature in #1691 ) and the V4L2 dmabuf
357+ capture written to feed it have been ** removed** . ` cros-codecs 0.0.6 ` (the latest)
358+ caret-pins ` cros-libva 0.0.12 ` , which does not compile against libva >= 2.23: the
359+ newer headers add ` seg_id_block_size ` / ` va_reserved8 ` to
360+ ` VAEncPictureParameterBufferVP9 ` , and ` cros-libva 0.0.12 ` 's struct literal omits
361+ them (` cros-libva 0.0.13 ` fixes it, but ` cros-codecs 0.0.6 ` won't accept it). Since
362+ modern distros and the nix toolchain ship libva 2.23+, the feature could not build
363+ or ship, and CI's ` --all-features ` could not be made green while it existed.
364+ ` cros-codecs ` is the only pure-Rust VAAPI H.264 encoder, and reintroducing ffmpeg
365+ for VAAPI defeats the purpose of this effort, so VAAPI is parked until ` cros-codecs `
366+ releases against ` cros-libva >= 0.0.13 ` (or a better VAAPI path appears). Intel/AMD
367+ Linux falls back to the openh264 software encoder meanwhile; NVIDIA uses NVENC.
368+
369+ When it returns: re-add ` backend/vaapi.rs ` , ` capture/v4l2.rs ` , the ` vaapi ` feature
370+ (+ ` cros-codecs ` /` v4l ` /` libc ` deps), ` Frame::DmaBuf ` , the ` requires_dmabuf ` capture
371+ coupling, and ` libva ` in the nix devShell. See this PR's history for the prior
372+ implementation; the V4L2 capture (REQBUFS/EXPBUF/QBUF/DQBUF) was compile-verified
373+ but never runtime-tested.
374+
375+ ### NVENC ships via dlopen (no driver dependency at build or load)
376+
377+ For the "single binary reaches the GPU at runtime" goal, NVENC must not hard-link
378+ the driver. The stock ` nvidia-video-codec-sdk ` emits
379+ ` cargo:rustc-link-lib=nvidia-encode ` / ` nvcuvid ` , which would make an
380+ ` --features nvenc ` binary (a) impossible to link on a GPU-less builder and (b)
381+ fail to even load on a machine without the NVIDIA driver (`DT_NEEDED
382+ libnvidia-encode.so.1` ), before ` backend::open`'s software fallback could run.
383+
384+ So ` nvenc ` dlopens everything at runtime, like ` cudarc ` does for CUDA:
385+
386+ - ` cudarc/fallback-dynamic-loading ` dlopens ` libcuda ` ; ` cudarc/cuda-12020 ` pins the
387+ CUDA API version so the build needs no CUDA toolkit.
388+ - ` nvidia-video-codec-sdk/dynamic-loading ` dlopens ` libnvidia-encode ` . This is a
389+ small fork feature (see the root ` [patch.crates-io] ` ): the SDK already routes
390+ every call through a function table built from two entry points
391+ (` NvEncodeAPICreateInstance ` / ` GetMaxSupportedVersion ` ); ` dynamic-loading `
392+ resolves those two via ` dlopen ` instead of linking them, and ` build.rs ` skips the
393+ link directives.
394+
395+ Result, verified on a GPU-less Linux box: ` --features nvenc ` builds, links, and the
396+ test suite runs and passes (NVENC unavailable -> falls back to openh264), and the
397+ binary has no ` libnvidia-encode ` / ` libcuda ` ` DT_NEEDED ` . So one portable ` moq-cli `
398+ can carry NVENC and use it only where the driver is present. Upstream the
399+ ` dynamic-loading ` feature and drop the patch once merged.
400+
354401### Follow-ups
355402
356- - VAAPI backend (phase 6) in a separate PR, behind a ` vaapi ` feature.
357- - NVENC hardware validation on Linux+GPU / CI.
358- - Live camera run (capture needs camera permission; only synthetic-frame encode is
359- tested here).
403+ - CI builds + tests NVENC normally on Linux (`cargo {check,test} -p moq-video
404+ --all-features`); the dlopen feature means no GPU/driver and no special flags are
405+ needed. moq-video stays excluded from the * workspace* ` --all-features ` runs only
406+ because its SDK crate has no macOS bindings (see ` rs/justfile ` 's ` ci ` recipe).
407+ - Still needed on real hardware: NVENC encode validation on a Linux+GPU box (pitch
408+ alignment, forced-IDR); only synthetic-frame software encode is tested here.
409+ - Live camera run (capture needs camera/screen TCC permission, which a headless or
410+ agent-spawned process can't obtain; run ` moq-cli ... capture ` from a user terminal).
360411- ` doc/bin/cli.md ` : the ` capture ` device-string semantics changed (index-or-path).
361412- Consider reusing NVENC input/output buffers across frames (currently allocated
362413 per frame to sidestep the self-referential Session borrow).
0 commit comments