Bug 225910 - VP9 detection in Media Capabilities is broken in STP124
Summary: VP9 detection in Media Capabilities is broken in STP124
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar, Regression
Depends on:
Blocks: 227940
  Show dependency treegraph
 
Reported: 2021-05-18 01:16 PDT by youenn fablet
Modified: 2021-07-13 22:10 PDT (History)
9 users (show)

See Also:


Attachments
Patch (7.28 KB, patch)
2021-05-19 22:25 PDT, Jean-Yves Avenard [:jya]
no flags Details | Formatted Diff | Diff
Patch (7.28 KB, patch)
2021-05-19 23:09 PDT, Jean-Yves Avenard [:jya]
no flags Details | Formatted Diff | Diff

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