Bug 263074 - WebAudio: Limit the number of realtime audio threads, and constrain their runtime
Summary: WebAudio: Limit the number of realtime audio threads, and constrain their run...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-10-12 08:40 PDT by Jer Noble
Modified: 2023-10-12 18:53 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 Jer Noble 2023-10-12 08:40:04 PDT
In 268047@main, RemoteAudioDestinationProxy threads were made to run in realtime mode, thereby avoiding audible stutters and dropouts in periods of high thread contention. However realtime threads come at a cost, and creating too many realtime threads is problematic from a kernel scheduling perspective. In some degenerate cases, sites can create many, many AudioContexts, each with their own realtime thread. Long term, this should be fixed via bug #263073, by coalescing compatable threads together. Until then, limit the number of concurrent realtime audio threads that can be created to 3, and adopt threading APIs (on Darwin OSs, for now) to constrain the runtime of these threads such that, when exceeded, the scheduler will demote the priority and runtime class of the thread to normal values.
Comment 1 Radar WebKit Bug Importer 2023-10-12 08:40:20 PDT
<rdar://problem/116864442>
Comment 2 Jer Noble 2023-10-12 09:28:56 PDT
Pull request: https://github.com/WebKit/WebKit/pull/19000
Comment 3 EWS 2023-10-12 18:53:26 PDT
Committed 269291@main (02ffbc50d8a6): <https://commits.webkit.org/269291@main>

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