Bug 235353 - [meta] Perform media networking operation off the main thread
Summary: [meta] Perform media networking operation off the main thread
Status: REOPENED
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: 205208 241061 243838
  Show dependency treegraph
 
Reported: 2022-01-19 04:09 PST by Jean-Yves Avenard [:jya]
Modified: 2022-08-11 15:12 PDT (History)
17 users (show)

See Also:


Attachments
WIP1 (8.76 KB, patch)
2022-01-19 04:21 PST, Jean-Yves Avenard [:jya]
no flags Details | Formatted Diff | Diff
WIP2 (59.05 KB, patch)
2022-01-20 06:01 PST, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP3 (85.73 KB, patch)
2022-01-24 06:46 PST, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP3 (85.91 KB, patch)
2022-01-24 07:22 PST, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP4 (93.85 KB, patch)
2022-01-25 00:30 PST, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP4 (94.59 KB, patch)
2022-01-25 06:17 PST, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP6 (95.34 KB, patch)
2022-01-30 20:13 PST, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
WIP6 (92.65 KB, patch)
2022-01-31 00:07 PST, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2022-01-19 04:09:49 PST
When playing multiple CRABS videos we can end up with a deadlock between the main thread and the CoreMedia player.

Currently data coming via PlatformMediaResourceLoader/PlatformMediaResourceClient comes on the main thread. 

When we have a sync call from the content process to the GPU Process to query status of the CoreMedia player this last one could be waiting for data to arrive on the main process. As the data will never come with the main thread blocked ; we end up in a deadlock.

This can be checked with this page:
https://webkit.apple.com/demos/bin/video/many-video-elements.html

Steps to reproduce:
1. Load <https://webkit.apple.com/demos/bin/video/many-video-elements.html> in Safari
2. Tap the “50” button to create 50 media elements
3. Playback will stall with < 50 elements successfully created

By moving the networking operations off the main thread, we could avoid a deadlock.
Comment 1 Jean-Yves Avenard [:jya] 2022-01-19 04:10:13 PST
rdar://84517825
Comment 2 Jean-Yves Avenard [:jya] 2022-01-19 04:21:28 PST
Created attachment 449473 [details]
WIP1
Comment 3 Jean-Yves Avenard [:jya] 2022-01-20 06:01:04 PST
Created attachment 449568 [details]
WIP2
Comment 4 Jean-Yves Avenard [:jya] 2022-01-24 06:46:12 PST
Created attachment 449809 [details]
WIP3
Comment 5 Jean-Yves Avenard [:jya] 2022-01-24 07:22:35 PST
Created attachment 449811 [details]
WIP3
Comment 6 Jean-Yves Avenard [:jya] 2022-01-25 00:30:40 PST
Created attachment 449903 [details]
WIP4
Comment 7 Jean-Yves Avenard [:jya] 2022-01-25 06:17:33 PST
Created attachment 449924 [details]
WIP4
Comment 8 Jean-Yves Avenard [:jya] 2022-01-30 20:13:53 PST
Created attachment 450374 [details]
WIP6

Fix crashes related to use of AtomString in ResourceResponse
Comment 9 Jean-Yves Avenard [:jya] 2022-01-31 00:07:20 PST
Created attachment 450386 [details]
WIP6

Fix crashes when GPU->WebContent connection is closed
Comment 10 Jean-Yves Avenard [:jya] 2022-05-18 05:22:56 PDT
Pull request: https://github.com/WebKit/WebKit/pull/719
Comment 11 EWS 2022-05-28 06:27:31 PDT
Committed r294999 (251097@main): <https://commits.webkit.org/251097@main>

Reviewed commits have been landed. Closing PR #719 and removing active labels.
Comment 12 Ryan Haddad 2022-05-31 16:36:30 PDT
This change was reverted in https://commits.webkit.org/251166@main because it introduced https://bugs.webkit.org/show_bug.cgi?id=241159