Bug 225910

Summary: VP9 detection in Media Capabilities is broken in STP124
Product: WebKit Reporter: youenn fablet <youennf>
Component: MediaAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, eric.carlson, ews-watchlist, glenn, jean-yves.avenard, jer.noble, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar, Regression
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=222473
Bug Depends on:    
Bug Blocks: 227940    
Attachments:
Description Flags
Patch
none
Patch none

Description youenn fablet 2021-05-18 01:16:40 PDT
Use https://jsfiddle.net/grdman/4n89ejzo/13 on BigSur with a Vp9 HW capable device.
Comment 1 Radar WebKit Bug Importer 2021-05-18 01:16:55 PDT
<rdar://problem/78144486>
Comment 2 Jean-Yves Avenard [:jya] 2021-05-19 22:25:04 PDT
Created attachment 429136 [details]
Patch
Comment 3 Darin Adler 2021-05-19 22:51:55 PDT
Comment on attachment 429136 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429136&action=review

> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h:66
> +    static void EnsureCodecsRegistered();

WebKit coding style uses a lowercase "E" for this kind of function name.

> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:67
> +    static bool sInitDone = []() {

We don’t normally use the "s" prefix for local variables. This idiom seems pretty nice for one time code; we should probably adopt it.
Comment 4 Jean-Yves Avenard [:jya] 2021-05-19 23:09:26 PDT
Created attachment 429139 [details]
Patch
Comment 5 Jean-Yves Avenard [:jya] 2021-05-19 23:17:34 PDT
It's not just the detection of VP9 powerEfficient that is currently broken.

If any Media Capabilities query is run before playing a video, it will state that the codec isn't supported.

As shown with this fiddle; which will return:
https://jsfiddle.net/pukj8ayo/2/

vp9 720p: not supported, not smooth and not power efficient.
vp9 1080p: not supported, not smooth and not power efficient.
vp9 4k: not supported, not smooth and not power efficient.
vp9 8k: not supported, not smooth and not power efficient.
h264 720p: supported, smooth and power efficient.
h264 1080p: supported, smooth and power efficient.
h264 4k: supported, smooth and power efficient.

But will return:
vp9 720p: supported, smooth and power efficient.
vp9 1080p: supported, smooth and power efficient.
vp9 4k: supported, smooth and power efficient.
vp9 8k: supported, smooth and power efficient.
h264 720p: supported, smooth and power efficient.
h264 1080p: supported, smooth and power efficient.
h264 4k: supported, smooth and power efficient.

once you've played a file or add a <video/> element in the fidle.
Comment 6 EWS 2021-05-19 23:46:51 PDT
Committed r277776 (237937@main): <https://commits.webkit.org/237937@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 429139 [details].
Comment 7 Eric Carlson 2021-05-20 09:34:13 PDT
Comment on attachment 429139 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=429139&action=review

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:282
> +        MediaSessionManagerCocoa::ensureCodecsRegistered();

You could call this from just MediaPlayer::buildMediaEnginesVector() instead of from every player factory.