Bug 232125 - Refactor handling of HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated
Summary: Refactor handling of HTMLMediaElement::mediaPlayerRenderingCanBeAccelerated
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
: 269684 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-21 18:19 PDT by Jean-Yves Avenard [:jya]
Modified: 2024-03-14 23:51 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2021-10-21 18:19:21 PDT
Related to bug 232124

There are three conditions that needs to be controlled:
1- Can the media player be accelerated
2- Can the renderer be accelerated
3- Should the video playing in this renderer be accelerated.

Right now, the logic is about as follow:

- The MediaPlayerPrivate contains the information related to 1.
- When the MediaPlayerPrivate needs to know 3) for the purpose of handling the call to acceleratedRenderingStateChanged, it will query the MediaPlayer, which queries the HTMLMediaElement client for 2), for this it will query the RenderLayerCompositor which will return false if accelerated rendering is disabled and if not queries the RenderVideo, which itself queries the HTMLMediaElement which queries the MediaElement which queries the MediaElementPrivate to determine if the player itself can be accelerated.

And there are some exceptions to the above if we are in PiP or in fullscreen then we assume it's always accelerated.

Not getting the information about the video being played in an accelerated layer right, causes the media to play without video and just audio. There's been multiple bugs related to the information not being correct when checked:
(bug 230495, bug 215594, bug 220375 to name a few)

We should split things so that the MediaPlayerPrivate only knows about 1; the compositor only knows about 2. And it's up to the HTMLMediaElement to determine 3 and relay this information to the MediaPlayerPrivate.

So there's no race or conflicting information between the various parties.
Comment 1 Radar WebKit Bug Importer 2021-10-21 18:20:31 PDT
<rdar://problem/84531384>
Comment 2 Jean-Yves Avenard [:jya] 2024-02-19 23:22:50 PST
*** Bug 269684 has been marked as a duplicate of this bug. ***
Comment 3 Jean-Yves Avenard [:jya] 2024-02-20 02:01:27 PST
Pull request: https://github.com/WebKit/WebKit/pull/24803
Comment 4 EWS 2024-02-22 00:22:24 PST
Committed 275158@main (48c940370411): <https://commits.webkit.org/275158@main>

Reviewed commits have been landed. Closing PR #24803 and removing active labels.
Comment 5 EWS 2024-03-14 23:51:56 PDT
Committed 272448.738@safari-7618-branch (2892e42cd07f): <https://commits.webkit.org/272448.738@safari-7618-branch>

Reviewed commits have been landed. Closing PR #1134 and removing active labels.