Skip to content

linux-pipewire: Fix crash with NV12 camera frames - #14002

Closed
theCarlG wants to merge 1 commit into
obsproject:masterfrom
theCarlG:fix/pipewire-nv12-planes
Closed

theCarlG wants to merge 1 commit into
obsproject:masterfrom
theCarlG:fix/pipewire-nv12-planes

Conversation

@theCarlG

@theCarlG theCarlG commented Oct 7, 2026

Copy link
Copy Markdown

Description

prepare_obs_frame() derives a single linesize from bytes per pixel, so NV12 frames from memory buffers got linesize width * 2 and no UV plane. libobs then read past the end of the buffer and crashed in obs_source_output_video().

Motivation and Context

Selecting a Pipewire Camera with NV12 crashes OBS as soon as we start to stream the camera. I reproduced this with my Elgato Facecam Pro, Sony A6700 and Sony A7V (both in streaming mode).

How Has This Been Tested?

On Arch Linux, OBS 32.2.2, PipeWire 1.6.9 with Elgato Facecam Pro, Sony A6700 and Sony A7V.

Before: PipeWire camera source with NV12 1920x1080@60 crashes OBS on stream
After: built linux-pipewire from 32.2.2 with this patch and installed it and NV12 1920x1080@60 runs without crashes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.
  • I have used AI tooling in the creation of this PR (Claude Opus 5.5 debugging and purposed a fix; I reviewed, revised and tested the code myself.)

NV12 got a single packed linesize (width * 2) and no UV plane, so libobs
read past the end of the buffer and crashed. Set up both planes from the
chunk stride and skip frames whose buffer is too small.
@Fenrirthviti

Copy link
Copy Markdown
Member

We do not accept AI-written code.

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.

2 participants