Skip to content

feat: decode H.265 and AV1 with NVDEC on Linux - #353

Merged
devopvoid merged 1 commit into
mainfrom
feat/nvdec-hevc-av1
Oct 11, 2026
Merged

devopvoid merged 1 commit into
mainfrom
feat/nvdec-hevc-av1

Conversation

@devopvoid

@devopvoid devopvoid commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Brings #350 to main. #350 was merged into feat/windows-hevc-codecs after that branch had already gone to main with #347, so its change never reached main. This is its squash commit (931b5e8) applied to main; the only codec code that differs between main and #350's base is #348's VP9 encoder, which touches no NVDEC or Linux file.

The NVDEC decoders on Linux decoded H.264 and VP9. They now decode H.265 (Main profile) and AV1 (profile 0) too, where the GPU does (AV1 since Ampere):

  • NvdecLibrary asks the driver (cuvidGetDecoderCaps) for H.265 and AV1 as it does for the others, and the factory offers what the GPU decodes: H.265 in the H265Format of feat: encode and decode H.265 in hardware on Windows #347, AV1 in profile 0.
  • NVDEC's own parser takes the bitstream, so a codec is mostly a matter of telling it which. Its AV1 parser takes temporal units, which begin with a temporal delimiter OBU, and WebRTC's AV1 frames come without one, so one is put in front.
  • Frames of AV1 spatial layers above the first go to dav1d, as those of VP9 go to libvpx.
  • H.265 has no software decoder to fall back to: what NVDEC cannot decode is an error, and WebRTC asks the sender for a key frame.
  • The Javadoc and the codec guide say so.

With NVENC's H.265 from #347, an NVIDIA GPU on Linux now carries H.265 calls both ways.

Rebased onto main after #352: where both describe Linux decoding (the hardware decoding table in the codec guide, the Javadoc of HardwareVideoDecoderFactory and the comment in LinuxHardwareVideoCodecFactories.cpp), the text now names NVDEC's four codecs and VA-API's VP9 decoder, when turned on. The code is #350's as it was.

Testing

  • Same tests as feat: decode H.265 and AV1 with NVDEC on Linux #350: the changed Linux sources compile with GCC 12 in WSL (Debian 12), syntax-only against the WebRTC headers with the defines of the Linux build; CI builds them for real.
  • The existing tests cover it on a Linux machine with an NVIDIA GPU: hardwareDecodesH265 and hardwareCropsPaddedH265 with NVENC and NVDEC, and the AV1 decoder tests.

Not verified

Nothing here has run on an NVIDIA GPU under Linux: there is none here, and CI has no GPU, where the hardware tests skip. In particular whether NVDEC's AV1 parser needs the temporal delimiter, which is harmless if it does not.

The NVDEC decoders decoded H.264 and VP9. They now decode H.265 (Main
profile) and AV1 (profile 0) as well, where the GPU does (AV1 since
Ampere), asking the driver which codecs it decodes. NVDEC's parser takes
the bitstream, so a codec is mostly a matter of telling it which.

NVDEC's AV1 parser takes temporal units, which begin with a temporal
delimiter, and WebRTC's AV1 frames come without one, so one is put in
front. Frames of AV1 spatial layers above the first go to dav1d, as those
of VP9 go to libvpx. H.265 has no software decoder to fall back to: what
NVDEC cannot decode is an error, and WebRTC asks for a key frame.

With NVENC's H.265, NVIDIA GPUs on Linux now carry H.265 calls both ways.
@devopvoid
devopvoid force-pushed the feat/nvdec-hevc-av1 branch from e6597de to 08a1215 Compare October 11, 2026 20:52
@devopvoid
devopvoid merged commit 78f74e5 into main Oct 11, 2026
24 checks passed
@devopvoid
devopvoid deleted the feat/nvdec-hevc-av1 branch October 11, 2026 21:59
SendableMetatype added a commit to EduGeyser/webrtc-java that referenced this pull request Oct 15, 2026
Brings in the work upstream added from October 11 to 15: hardware video
codecs on every platform, through Media Foundation, VideoToolbox, VA-API
and NVDEC, with WebRTC built with H.265 (devopvoid#346 to devopvoid#348, devopvoid#352, devopvoid#353, devopvoid#356,
devopvoid#359, devopvoid#371 to devopvoid#377); HEVC and AV1 decoding in the media player, with
dav1d and Vulkan Video (devopvoid#331, devopvoid#345); encoded frame injectors (devopvoid#365);
receiver source changes and audio packet infos (devopvoid#366); audio codec
factories (devopvoid#340); network thread observers called on a callback thread
(devopvoid#364); screen capture with ScreenCaptureKit (devopvoid#354); Windows audio
devices that mix more than two channels (devopvoid#358); autoninja (devopvoid#357); and
the release channels of the docs site (devopvoid#361).

Fork-side adaptations:
- The factory keeps the CreatePeerConnectionFactory overload without a
  worker thread, and still switches device capture on the network
  thread. devopvoid#355 copies WebRTC's factory setup and has the audio module
  learn a worker thread, which only matters for a worker thread distinct
  from the network thread, and WebRTC is removing those. The audio codec
  factories and hardware codec switches of devopvoid#340 and devopvoid#359 go to that
  overload.
- WebRTC stays on a commit on main, so the move to branch 8059 (devopvoid#360)
  and its fixed clang package are left out.
- The data channels variant builds WebRTC without H.265 and without the
  extra targets, leaves out the audio codec factory bindings and
  addTransceiverOfType, and skips the new tests that need audio or
  video.
- dav1d is built against the sysroot on native Linux builds as well, as
  FFmpeg is. CI installs Meson for the full variant only, checks out the
  dav1d submodule, and adds its commit to the FFmpeg cache key. The
  fork's Windows SDK step stays, without upstream's second one.
- The release workflow records the docs' version in the tagged commit,
  as upstream's now does. The docs site still builds from main, since
  this fork publishes none.
- The Maven files stay deleted: Jetty is bumped in the version catalog,
  and the docs lockfile takes upstream's bumps on top of the fork's
  newer VitePress.
- The media module's README builds with Gradle.
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