Bump QoS to UserInteractive for real-time audio rendering thread. We create our own thread on WebContent side when the GPU Process is enabled since the CoreAudio rendering thread lives in the GPU Process. To ensure the same quality of service, we need to make sure the thread we create gets very high QoS.
Created attachment 416194 [details] Patch
Created attachment 416196 [details] Patch
Comment on attachment 416196 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416196&action=review > Source/WTF/ChangeLog:8 > + Add QOS parameter to the Thread construct (similarly to WorkQueue) so that the caller can Maybe priority is a better name for the parameter?
(In reply to Peng Liu from comment #3) > Comment on attachment 416196 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416196&action=review > > > Source/WTF/ChangeLog:8 > > + Add QOS parameter to the Thread construct (similarly to WorkQueue) so that the caller can > > Maybe priority is a better name for the parameter? QoS (quality of service) is the naming on our platforms. The concept of process/thread priority also exists on our platforms but has a different meaning. As a result, I wouldn't want to conflate the 2. Also note that I am merely following the pattern in WorkQueue, not introducing a new concept in this patch.
Comment on attachment 416196 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416196&action=review > Source/WebCore/Modules/webaudio/AudioWorkletThread.cpp:69 > + }, ThreadType::Audio, m_parameters.isAudioContextRealTime ? Thread::QOS::UserInteractive : Thread::QOS::Default); What's the non-realtime case for audio? > Source/WebCore/worklets/WorkletParameters.h:40 > + bool isAudioContextRealTime; Where does this get initialized?
(In reply to Geoffrey Garen from comment #5) > Comment on attachment 416196 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=416196&action=review > > > Source/WebCore/Modules/webaudio/AudioWorkletThread.cpp:69 > > + }, ThreadType::Audio, m_parameters.isAudioContextRealTime ? Thread::QOS::UserInteractive : Thread::QOS::Default); > > What's the non-realtime case for audio? When you construct an OfflineAudioContext (instead of an AudioContext), audio is rendered offline into a buffer instead of in real time on the speakers. > > > Source/WebCore/worklets/WorkletParameters.h:40 > > + bool isAudioContextRealTime; > > Where does this get initialized? Yes, it is, based on whether or not the AudioContext is offline or not, which answers your question above.
Comment on attachment 416196 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=416196&action=review > Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.cpp:57 > + worklet.audioContext() ? !worklet.audioContext()->isOfflineContext() : false For Geoff, this is where the isAudioContextRealTime flag gets initialized.
👍🏻
Committed r270806: <https://trac.webkit.org/changeset/270806> All reviewed patches have been landed. Closing bug and clearing flags on attachment 416196 [details].
<rdar://problem/72317707>