Skip to content

fix(libmoq): unbreak the Linux C link list, and make VAAPI opt-in - #2669

Merged
kixelated merged 4 commits into
mainfrom
agent/make-vaapi-opt-in
Aug 5, 2026
Merged

kixelated merged 4 commits into
mainfrom
agent/make-vaapi-opt-in

Conversation

@kixelated

@kixelated kixelated commented Aug 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Drop the stale va / va-drm entries from libmoq's Linux link list, which currently break every C consumer on a host without libva-dev.
  • Make VAAPI opt-in for moq-video, moq-transcode, moq-cli, libmoq, and moq-boy, because the backend has never been validated on hardware.
  • Remove libva from the Nix dev shell and correct the docs/comments that justified the feature by its libva dependency.

The link list is a real bug

rs/libmoq/native-libs/linux.txt feeds Libs.private in the generated moq.pc and MOQ_NATIVE_LIBS in the CMake package, so every C consumer of libmoq on Linux was forced to link -lva -lva-drm. Nothing has needed them since moq-vaapi 0.0.3 (#2465) switched to dlopen, which leaves no NEEDED entry in the archive.

A host with libva-dev installed never noticed. The nightly interop run does, since the runners carry the runtime libva2 (an ffmpeg dependency) but no libva-dev, so there is no libva.so symlink for -lva to resolve:

/usr/bin/ld: cannot find -lva: No such file or directory
/usr/bin/ld: cannot find -lva-drm: No such file or directory

That is the c-pkgconfig and c-cmake clients failing to build in https://github.com/moq-dev/smoke/actions/runs/30997849385. It is a separate commit here so it can be cherry-picked; smoke builds against the published libmoq-v* tarball, so the nightly stays red until libmoq is released with this in it.

Why VAAPI goes opt-in

Not the dependency: moq-vaapi 0.0.3 dlopens libva and vendors the headers its bindgen reads, so an enabled-vaapi build needs no libva-dev, links on a libva-less builder, and starts on a libva-less host, where backend selection falls back to the next encoder. The reason is that the encode path has never run on real hardware, as encode::backend::vaapi's module docs have said since it landed. It stays a supported feature, just one a consumer asks for.

The comments and docs that explained the feature by "it links / requires libva" were wrong on that point and now say what is actually true.

Public API changes

  • No Rust symbols changed.
  • vaapi is no longer a default feature of moq-video or moq-transcode. Cargo treats removing a default feature as breaking, and cargo-semver-checks does not detect it, so it wants a line in the changelog even though nothing in the API moved.

Behavior changes

  • libmoq and moq-boy no longer bundle VAAPI, so on Linux Intel/AMD they fall back to openh264 software encode. Selecting it by name (MOQ_VIDEO_ENCODER_KIND_NAMED with "vaapi") now returns NoEncoder; the name is dropped from the header's example list.
  • moq-cli's vaapi feature still exists and still composes with capture / transcode, it just has to be named.

Test plan

  • nix develop --command just fix / just check
  • CI's just rs ci still compiles the backend: its clippy / doc / nextest passes are --all-features, and VAAPI needs nothing from the dev shell to build.
  • Not hardware-tested, same as before.

(Written by Opus 5)

`native-libs/linux.txt` feeds `Libs.private` in the generated `moq.pc` and
`MOQ_NATIVE_LIBS` in the CMake package, so every C consumer of libmoq on Linux
was forced to link `-lva -lva-drm`. Nothing in libmoq has needed them since
moq-vaapi 0.0.3 (#2465), which dlopens libva and leaves no `NEEDED` entry
behind: the entries were stale, not load-bearing.

A host with libva-dev installed never noticed. One without it fails at link
time, which is what the nightly interop run hits today:

    /usr/bin/ld: cannot find -lva: No such file or directory
    /usr/bin/ld: cannot find -lva-drm: No such file or directory

The runners carry the runtime libva2 (an ffmpeg dependency) but no libva-dev,
so there is no `libva.so` symlink for `-lva` to resolve, and the pkg-config and
CMake C clients fail to build.
The VAAPI encode backend has never been validated on real hardware (see the
module docs on `encode::backend::vaapi`), yet it was on by default in
moq-video, moq-transcode, and moq-cli, and explicitly enabled in libmoq and
moq-boy. Keep the feature, but let a consumer ask for it.

The build cost is not the reason. moq-vaapi 0.0.3 dlopens libva and vendors the
headers its bindgen reads, so an enabled-vaapi build needs no libva-dev, links
on a libva-less builder, and starts on a libva-less host. The comments and docs
that justified the feature by "it needs libva" were wrong on that point and now
say what is actually true.

Also drops libva from the dev shell, which was only there to run the backend
nobody now builds by default.
@kixelated
kixelated force-pushed the agent/make-vaapi-opt-in branch from 2b5ca20 to e64c44a Compare August 5, 2026 15:42
@kixelated kixelated changed the title fix(video): make VAAPI opt-in fix(libmoq): unbreak the Linux C link list, and make VAAPI opt-in Aug 5, 2026
@kixelated
kixelated marked this pull request as ready for review August 5, 2026 15:45
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@kixelated, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 69b3cd0f-a67c-47a8-ad1a-d67c90f8af30

📥 Commits

Reviewing files that changed from the base of the PR and between defd43e and 97ae5bf.

📒 Files selected for processing (2)
  • rs/libmoq/src/video.rs
  • rs/moq-ffi/src/video.rs

Walkthrough

VAAPI was removed from default feature sets in moq-video, moq-transcode, and moq-cli. NVIDIA codec features remain enabled by default where configured. Workspace consumers and documentation now describe VAAPI as opt-in. VAAPI documentation now states that libva loads dynamically. The Nix development dependencies and Linux CI notes no longer require libva. Backend and API comments were updated to match the new feature behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies both main changes: fixing the Linux C link list and making VAAPI opt-in.
Description check ✅ Passed The description directly explains the link-list fix, VAAPI default change, behavior changes, and test plan.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch agent/make-vaapi-opt-in

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@doc/bin/cli.md`:
- Around line 243-247: Update the Linux capture dependency wording near the
no-default-features command to avoid claiming that all system library
dependencies are removed: clarify that it removes the default dependencies for
NVENC, VAAPI, libclang/V4L2, and PipeWire, while audio capture remains enabled
and still requires cpal’s ALSA system dependency.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a721a0fc-1229-4167-a914-0fd38cd8d834

📥 Commits

Reviewing files that changed from the base of the PR and between 525d74e and e64c44a.

📒 Files selected for processing (17)
  • Cargo.toml
  • doc/bin/cli.md
  • doc/lib/rs/crate/moq-video.md
  • flake.nix
  • rs/CLAUDE.md
  • rs/justfile
  • rs/libmoq/Cargo.toml
  • rs/libmoq/native-libs/linux.txt
  • rs/libmoq/src/video.rs
  • rs/moq-boy/Cargo.toml
  • rs/moq-cli/Cargo.toml
  • rs/moq-ffi/Cargo.toml
  • rs/moq-transcode/Cargo.toml
  • rs/moq-video/Cargo.toml
  • rs/moq-video/DESIGN-native-codecs.md
  • rs/moq-video/src/encode/backend/vaapi.rs
  • test/smoke/clients/c/subscribe.c
💤 Files with no reviewable changes (2)
  • rs/libmoq/native-libs/linux.txt
  • flake.nix

Comment thread doc/bin/cli.md Resolved
`--no-default-features` drops the NVENC / VAAPI / PipeWire system libraries, but
`capture` still pulls libclang + the V4L2 headers for the camera and ALSA for the
microphone, so "no system library dependency" was never true of that build.
@kixelated
kixelated enabled auto-merge (squash) August 5, 2026 15:57
libmoq no longer enables moq-video's `vaapi` feature, but two doc comments
still advertise the backend.

`libmoq::video`'s module doc claimed the FFI boundary runs "NVENC/VAAPI/NVDEC
on Linux". The `moq_video_encoder_output::encoder` doc in the same file was
already fixed; this is the other half. cbindgen emits item docs into moq.h but
not `//!` module docs, so this one is rustdoc-only.

`moq-ffi`'s `MoqVideoEncoderKind` called NVENC and VAAPI "a libmoq-only build
option". NVENC/NVDEC still are; VAAPI is now opt-in everywhere, enabled by no
shipped consumer. The conclusion (Linux here is software-only) is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant