Bug 256848 - VideoFrame buffer constructor doesn't respect codedWidth if visibleRect is present
Summary: VideoFrame buffer constructor doesn't respect codedWidth if visibleRect is pr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 16
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2023-05-16 10:27 PDT by Brooke Vibber
Modified: 2023-07-07 08:30 PDT (History)
5 users (show)

See Also:


Attachments
Drawn gradient frame with packed (16 stride) and extra bytes (32 stride) on 16x16 input, as seen in Safari 16.4 (64.33 KB, image/png)
2023-05-16 10:27 PDT, Brooke Vibber
no flags Details
rendering in safari, firefox, chrome (511.74 KB, image/png)
2023-05-16 18:25 PDT, Karl Dubost
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.