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

  Changed paths:
    A LayoutTests/http/wpt/media/media-vp9-yuv422p8-expected.txt
    A LayoutTests/http/wpt/media/media-vp9-yuv422p8.html
    A LayoutTests/http/wpt/media/resources/test-vp9-yuv422p-128x128.webm
    A LayoutTests/http/wpt/media/resources/test-vp9-yuv422p-128x97.webm
    M LayoutTests/platform/ios/TestExpectations
    M 
Source/ThirdParty/libwebrtc/Source/webrtc/webkit_sdk/WebKit/WebKitUtilities.mm

  Log Message:
  -----------
  8-bit YUV 4:2:2 VP9 frames from the software decoder are converted to NV12 
with U and V swapped
https://bugs.webkit.org/show_bug.cgi?id=325861
rdar://188857520

Reviewed by Youenn Fablet.

The conversion of libwebrtc buffers to
CVPixelBuffers had three defects, the first two in the 8-bit
4:2:2 path added in 293620@main.

1) I422 buffers were converted with libyuv::I422ToNV21(), which writes the 
interleaved chroma in
   V, U order, into a 420YpCbCr8BiPlanar buffer that is read in Cb, Cr order. 
Every 8-bit 4:2:2
   frame was displayed with its chroma channels swapped.

2) The I422 size check compared the chroma height divided by 2, rounded down, 
with the NV12 chroma
   plane height, so the copy failed for every odd frame height.

3) A failed copy was not handled: the size-mismatch returns left the pixel 
buffer locked, the I010
   and I210 copies ignored the result of the libyuv conversion, and
   createPixelBufferFromFrameBuffer() ignored the result of the copy and 
returned an unfilled buffer.

U and V are now passed to I422ToNV21() in reverse order, which makes it write 
NV12, and the size
check rounds the chroma height up. The copy functions hold the base address 
lock with a
scoped
PixelBufferBaseAddressLocker, so every return unlocks it, and all of them 
return the libyuv result.
createPixelBufferFromFrameBuffer() releases the buffer and returns nullptr when 
the copy fails.

The iOS expectation skipping media/vp9.html and media/media-vp9-yuv422p10.html 
is removed:
WebCoreDecompressionSession falls back to the software VP9 decoder, which ships 
on iOS.

* LayoutTests/http/wpt/media/media-vp9-yuv422p8-expected.txt: Added.
* LayoutTests/http/wpt/media/media-vp9-yuv422p8.html: Added.
* LayoutTests/http/wpt/media/resources/test-vp9-yuv422p-128x128.webm: Added.
* LayoutTests/http/wpt/media/resources/test-vp9-yuv422p-128x97.webm: Added.
* LayoutTests/platform/ios/TestExpectations:
* 
Source/ThirdParty/libwebrtc/Source/webrtc/webkit_sdk/WebKit/WebKitUtilities.mm:
(webrtc::PixelBufferBaseAddressLocker::PixelBufferBaseAddressLocker): Added.
(webrtc::PixelBufferBaseAddressLocker::~PixelBufferBaseAddressLocker):
Added.
(webrtc::CopyVideoFrameToPixelBuffer): Lock with PixelBufferBaseAddressLocker 
and return the libyuv
result. Pass V before U to I422ToNV21() and round the I422 chroma height up.
(webrtc::createPixelBufferFromFrameBuffer): Release the buffer and return 
nullptr when the copy fails.

Canonical link: 
https://flagged.apple.com:443/proxy?t2=Dw0k7b0GZ3&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzIyNDc3QG1haW4=&emid=75a1ce6f-48ce-4c49-b429-61e9e2e0bdd0&c=11



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

Reply via email to