Bug 256848

Summary: VideoFrame buffer constructor doesn't respect codedWidth if visibleRect is present
Product: WebKit Reporter: Brooke Vibber <bvibber>
Component: MediaAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, jer.noble, karlcow, webkit-bug-importer, youennf
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Drawn gradient frame with packed (16 stride) and extra bytes (32 stride) on 16x16 input, as seen in Safari 16.4
none
rendering in safari, firefox, chrome none

Description Brooke Vibber 2023-05-16 10:27:06 PDT
Created attachment 466363 [details]
Drawn gradient frame with packed (16 stride) and extra bytes (32 stride) on 16x16 input, as seen in Safari 16.4

When creating a VideoFrame from an ArrayBuffer, if the codedWidth is wider than the provided visibleWidth, the resulting frame is corrupted in Safari, while it works as expected in Chrome.

Here's a sample jsfiddle which works as expected in Chrome on my M1 MacBook Air but fails in Safari on the M1 MacBook Air, iPhone 13, and i9 MacBook Pro:

https://jsfiddle.net/1tf8g04c/

I've worked around it in my case by simply producing packed frames that don't need a larger codedWidth, but this may not always be convenient.
Comment 1 Karl Dubost 2023-05-16 18:25:01 PDT
Created attachment 466372 [details]
rendering in safari, firefox, chrome

Rendering in the latest versions of STP, nightly and canary

Tested on macOS 13.4
---
Safari Technology Preview  169           18616.1.12.2
Firefox Nightly            115.0a1       11523.5.10
Google Chrome Canary       115.0.5762.0  5762.0
Comment 2 Radar WebKit Bug Importer 2023-05-23 10:28:17 PDT
<rdar://problem/109724698>
Comment 3 youenn fablet 2023-07-07 02:24:00 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15626
Comment 4 EWS 2023-07-07 08:30:41 PDT
Committed 265844@main (e919dcfad3da): <https://commits.webkit.org/265844@main>

Reviewed commits have been landed. Closing PR #15626 and removing active labels.