Bug 240999 - Simplify MediaPlayerPrivateRemote::RequestResource API
Summary: Simplify MediaPlayerPrivateRemote::RequestResource API
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
Depends on:
Blocks:
 
Reported: 2022-05-26 19:59 PDT by Jean-Yves Avenard [:jya]
Modified: 2022-05-27 07:47 PDT (History)
1 user (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] 2022-05-26 19:59:11 PDT
When the GPU Process' MediaPlayerProxy needs to allocate a new MediaResource it sends a message to the content process via the MediaPlayerPrivateRemote::RequestResource IPC call with a RemoteMediaResourceIdentifier which will then respond with that same RemoteMediaResourceIdentifier to indicate that the MediaResource is now "ready".

There's two scenarios possible here.
Either the creation of the media resource in the content process is successful or it's not.

If it's successful the content process will start sending data starting by a call to the GPU's RemoteMediaResourceManager responseReceived
Or it will fail and call RemoteMediaResourceManager::LoadFailed.

The RemoteMediaResourceManager will only accept incoming data once the MediaResource's ready status is true, and if you're only working on the main thread, it will always be, as the Content Process' RequestResource response will always be received before either LoadFailed or ResponseReceived call.

So if only working on the main thread as we do now, this ready status is totally redundant.

However, if we want to parallelise networking operations so that ResponseReceived and LoadFailed will be called on a secondary thread as introduced in bug 235353; the "ready" flag becomes problematic as the response from a RequestResource is happening on the main thread.
The multi-threaded nature of the work means that the RequestResource response could be received only after LoadFailed or ResponseReceived message; and if that's the case those two messages will be dropped.

This can be seen with the intermittent failures occurring with media/video-src-blob-replay.html test.

So we will remove this concept of RemoteMediaResource::ready as at best it serves no purpose.
Comment 1 Radar WebKit Bug Importer 2022-05-26 19:59:27 PDT
<rdar://problem/94012261>
Comment 2 Jean-Yves Avenard [:jya] 2022-05-26 22:21:41 PDT
Pull request: https://github.com/WebKit/WebKit/pull/1086
Comment 3 EWS 2022-05-27 07:47:52 PDT
Committed r294937 (251048@main): <https://commits.webkit.org/251048@main>

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