Bug 219797

Summary: [GPUProcess] WebAudio rendering quantum is 15 instead of 128 when the GPU Process is enabled
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web AudioAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, eric.carlson, ews-watchlist, ggaren, glenn, jer.noble, peng.liu6, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2020-12-11 11:58:06 PST
WebAudio rendering quantum is 15 instead of 128 when the GPU Process is enabled. This generates a lot more IPC unnecessarily, not to mention how WebAudio code expects a rendering quantum of 128 and could potentially do bad things with a lower value.
Comment 1 Chris Dumez 2020-12-11 12:00:36 PST
Created attachment 416025 [details]
Patch
Comment 2 Peng Liu 2020-12-11 12:13:15 PST
Comment on attachment 416025 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416025&action=review

> Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp:108
> +        if (otherProxy.preferredBufferSize() && otherProxy.preferredBufferSize() < preferredBufferSize)

Do we need to consider the case that "otherProxy.preferredBufferSize()" returns a different value such as -1 if not set? I mean potentially.
Comment 3 Chris Dumez 2020-12-11 12:14:32 PST
(In reply to Peng Liu from comment #2)
> Comment on attachment 416025 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=416025&action=review
> 
> > Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp:108
> > +        if (otherProxy.preferredBufferSize() && otherProxy.preferredBufferSize() < preferredBufferSize)
> 
> Do we need to consider the case that "otherProxy.preferredBufferSize()"
> returns a different value such as -1 if not set? I mean potentially.

size_t m_preferredBufferSize { 0 };

It is initialized to 0 by default. Also, it is unsigned.
Comment 4 Peng Liu 2020-12-11 12:17:14 PST
Comment on attachment 416025 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=416025&action=review

>>> Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp:108
>>> +        if (otherProxy.preferredBufferSize() && otherProxy.preferredBufferSize() < preferredBufferSize)
>> 
>> Do we need to consider the case that "otherProxy.preferredBufferSize()" returns a different value such as -1 if not set? I mean potentially.
> 
> size_t m_preferredBufferSize { 0 };
> 
> It is initialized to 0 by default. Also, it is unsigned.

Oh that's right! I looked AudioSession::preferredBufferSize() by mistake. :-)
Comment 5 EWS 2020-12-11 13:04:48 PST
Committed r270705: <https://trac.webkit.org/changeset/270705>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 416025 [details].
Comment 6 Radar WebKit Bug Importer 2020-12-11 13:05:19 PST
<rdar://problem/72235555>