Bug 216534 - Add internal flag to enable/disable H264 hardware encoder
Summary: Add internal flag to enable/disable H264 hardware encoder
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-15 03:37 PDT by youenn fablet
Modified: 2020-09-18 10:43 PDT (History)
11 users (show)

See Also:


Attachments
Patch (5.42 KB, patch)
2020-09-15 03:39 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (7.67 KB, patch)
2020-09-17 05:06 PDT, youenn fablet
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (7.74 KB, patch)
2020-09-17 06:19 PDT, youenn fablet
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 2020-09-15 03:37:14 PDT
Add internal flag to enable/disable H264 hardware encoder
Comment 1 youenn fablet 2020-09-15 03:39:41 PDT
Created attachment 408812 [details]
Patch
Comment 2 Sam Weinig 2020-09-15 09:04:34 PDT
Comment on attachment 408812 [details]
Patch

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

> Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:53
> +LibWebRTCProviderCocoa::LibWebRTCProviderCocoa()
> +{
> +    setH264HardwareEncoderAllowed(RuntimeEnabledFeatures::sharedFeatures().webRTCH264HardwareEncoderEnabled());
> +}
> +

This is a layering violation. Code in platform/ should not know about/call code in page/.  While people have recently not been observing this rule, platform code is meant to wrap a platform concept, so should not be directly modifiable by WebKit level preferences like this.

Instead, the model that works is have the non-platform part of the code that uses this set this setting.
Comment 3 youenn fablet 2020-09-15 10:01:16 PDT
OK, will think about it more.
Comment 4 youenn fablet 2020-09-17 05:06:51 PDT
Created attachment 409023 [details]
Patch
Comment 5 youenn fablet 2020-09-17 06:19:39 PDT
Created attachment 409028 [details]
Patch
Comment 6 Sam Weinig 2020-09-18 08:11:22 PDT
While this is no longer a layering violation, this still maintains the issue of not being really working with the page-based model of WebKit preferences. 

Is the H264 hardware encoder something that has to be enabled/disable on a process wide basis? Could we always enable it but not filter our uses when disabled for a page?
Comment 7 youenn fablet 2020-09-18 08:17:05 PDT
(In reply to Sam Weinig from comment #6)
> While this is no longer a layering violation, this still maintains the issue
> of not being really working with the page-based model of WebKit preferences. 
> 
> Is the H264 hardware encoder something that has to be enabled/disable on a
> process wide basis? Could we always enable it but not filter our uses when
> disabled for a page?

We could change the implementation to do like we do for VP9 and HEVC (have an encoder parameter). Slightly more complex but doable.
Given this is for testing only though, the process wide parameter seems good enough.
Comment 8 EWS 2020-09-18 10:26:29 PDT
Committed r267249: <https://trac.webkit.org/changeset/267249>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 409028 [details].
Comment 9 Radar WebKit Bug Importer 2020-09-18 10:27:21 PDT
<rdar://problem/69160129>
Comment 10 Sam Weinig 2020-09-18 10:34:40 PDT
(In reply to youenn fablet from comment #7)
> (In reply to Sam Weinig from comment #6)
> > While this is no longer a layering violation, this still maintains the issue
> > of not being really working with the page-based model of WebKit preferences. 
> > 
> > Is the H264 hardware encoder something that has to be enabled/disable on a
> > process wide basis? Could we always enable it but not filter our uses when
> > disabled for a page?
> 
> We could change the implementation to do like we do for VP9 and HEVC (have
> an encoder parameter). Slightly more complex but doable.
> Given this is for testing only though, the process wide parameter seems good
> enough.

This is very discouraging. I have been working to remove process wide state like this, and adding more against my objection only adds to my work.
Comment 11 youenn fablet 2020-09-18 10:43:26 PDT
> This is very discouraging. I have been working to remove process wide state
> like this, and adding more against my objection only adds to my work.

I understand the desire for purity.
I do not really see the impact of how this is slowing down your work.
Strictly speaking, this patch is not introducing any new process wide state, the process wide state was there before this patch.

I can remove the pre-existing process wide state as a follow-up but would like to understand the benefit in this particular case.

FYI, the purpose of the flag is to help a team reproing an ongoing issue more easily.