Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 790f56e77cc49b1f630703b3b485bb073bbe8ad8
      
https://github.com/WebKit/WebKit/commit/790f56e77cc49b1f630703b3b485bb073bbe8ad8
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    A LayoutTests/http/wpt/webcodecs/encoder-from-10-bit-frame-expected.txt
    A LayoutTests/http/wpt/webcodecs/encoder-from-10-bit-frame.html
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/platform/libwebrtc/LibWebRTCVPXVideoEncoder.cpp

  Log Message:
  -----------
  WebCodecs VP8/VP9/AV1 encoder encodes uninitialized data when given 10-bit 
frames
https://bugs.webkit.org/show_bug.cgi?id=325886
rdar://188868992

Reviewed by Youenn Fablet.

LibWebRTCVPXInternalVideoEncoder::encode() converted RGB input to NV12 and 
passed every other pixel
buffer to libwebrtc as a native buffer. The encoders then called ToI420(), and
-[RTCCVPixelBuffer toI420] only handles 8-bit NV12 and 32-bit RGB: for any 
other format it returned
the I420 buffer it had allocated without filling it, so 10-bit frames, such as 
those produced by the
VP9 profile 2 decoder, were encoded from uninitialized memory.

Pixel buffers that are not 8-bit NV12 are now converted to BT709 8-bit NV12 
with the frame's range
before being handed to libwebrtc, and the frame's color space is set to BT709 
so that the encoder and
the reported decoder configuration describe the converted pixels. The first 
such conversion is logged
once per encoder. The encode fails if there is no buffer to encode.

* LayoutTests/http/wpt/webcodecs/encoder-from-10-bit-frame-expected.txt: Added.
* LayoutTests/http/wpt/webcodecs/encoder-from-10-bit-frame.html: Added.
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/platform/libwebrtc/LibWebRTCVPXVideoEncoder.cpp:
(WebCore::LibWebRTCVPXInternalVideoEncoder::encode): Convert non-NV12 input to 
BT709 NV12, signal the
BT709 color space and log the conversion once. Reject the encode when there is 
no buffer.

Canonical link: https://commits.webkit.org/322968@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to