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.
<rdar://problem/116864442>
Pull request: https://github.com/WebKit/WebKit/pull/19000
Committed 269291@main (02ffbc50d8a6): <https://commits.webkit.org/269291@main> Reviewed commits have been landed. Closing PR #19000 and removing active labels.