Bug 214316

Summary: [Cocoa] Add MediaCapabilities support for SW VP9 decoder.
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: New BugsAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, ews-watchlist, glenn, peng.liu6, philipj, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
eric.carlson: review+
Patch for landing
none
Patch for landing none

Description Jer Noble 2020-07-14 13:22:48 PDT
[Cocoa] Add MediaCapabilities support for SW VP9 decoder.
Comment 1 Radar WebKit Bug Importer 2020-07-14 13:38:37 PDT
<rdar://problem/65561815>
Comment 2 Jer Noble 2020-07-14 13:41:40 PDT
Created attachment 404274 [details]
Patch
Comment 3 Jer Noble 2020-07-14 13:48:21 PDT
Created attachment 404276 [details]
Patch
Comment 4 Jer Noble 2020-07-14 14:03:15 PDT
Created attachment 404282 [details]
Patch
Comment 5 Jer Noble 2020-07-14 15:28:35 PDT
Created attachment 404293 [details]
Patch
Comment 6 Eric Carlson 2020-07-14 16:55:45 PDT
Comment on attachment 404293 [details]
Patch

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

> Source/WebCore/ChangeLog:11
> +        both on the system battery status, but also power adapter status, and these need to be shipped

Nit: s/both on the system battery status, but also power adapter status/both on the system battery status and the power adapter status/

> Source/WebCore/platform/cocoa/SystemBattery.mm:104
> +                CFDictionaryRef description = IOPSGetPowerSourceDescription(powerSourcesInfo.get(), CFArrayGetValueAtIndex(powerSourcesList.get(), i));

IOPSGetPowerSourceDescription can return NULL according to the docs, and CFDictionaryGetValue(NULL) will crash.

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:97
> +        // HW VP9 Decoder Profile 0 & 2:
> +        if (!codecConfiguration.profile && codecConfiguration.profile != 2)

I don't think you want the `!` here

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:101
> +        // HW VP9 Decoder supports up to Level 6:
> +        if (codecConfiguration.level > 60)

Is it 6 or 60?

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:109
> +        if (codecConfiguration.chromaSubsampling > 1)

It'd be nice to have an enum for the chromaSubsampling values, or at least a named constant for 420

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:117
> +        if (videoConfiguration.height <= 2160 && videoConfiguration.framerate > 120)

Named constants would be helpful for future engineers.

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:119
> +        else if (videoConfiguration.height > 2160 && videoConfiguration.framerate > 30)

Ditto

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:130
> +    if (videoConfiguration.height <= 1080 && videoConfiguration.framerate > 60)

Ditto

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:132
> +    if (videoConfiguration.height <= 2160 && videoConfiguration.framerate > 30)

Ditto

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:153
> +    auto is4kScreen = [](float width, float height, float scale) {

Why have the width parameter if it isn't used?

> Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:155
> +        return height * scale >= 2160;

`2160` again.

> Source/WebCore/testing/Internals.h:1025
> +    void setHardwareVP9DecoderDisabledForTesting(bool);
> +    void setVP9ScreenSizeAndScale(double, double, double);

All four should have the "ForTesting" suffix or none should.
Comment 7 Jer Noble 2020-07-15 10:56:24 PDT
Created attachment 404358 [details]
Patch for landing
Comment 8 Jer Noble 2020-07-16 09:21:20 PDT
Created attachment 404446 [details]
Patch for landing
Comment 9 EWS 2020-07-16 13:49:40 PDT
Committed r264476: <https://trac.webkit.org/changeset/264476>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 404446 [details].