Bug 217663

Summary: WebAudio tests are crashing in debug when enabling the GPU process
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web AudioAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, benjamin, cdumez, cmarcelo, eric.carlson, ews-watchlist, ggaren, glenn, gyuyoung.kim, jer.noble, peng.liu6, philipj, ryuan.choi, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch none

Description Chris Dumez 2020-10-13 12:12:55 PDT
WebAudio tests are crashing in debug when enabling the GPU process because it does audio processing on the WebContent process' main thread.
Comment 1 Chris Dumez 2020-10-13 12:30:47 PDT
Created attachment 411237 [details]
Patch
Comment 2 Chris Dumez 2020-10-13 12:39:44 PDT
Created attachment 411238 [details]
Patch
Comment 3 Chris Dumez 2020-10-13 12:54:27 PDT
Created attachment 411240 [details]
Patch
Comment 4 Geoffrey Garen 2020-10-13 13:19:56 PDT
Comment on attachment 411240 [details]
Patch

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

r=me

> Source/WTF/ChangeLog:13
> +        deque (since the queue is empty).

dequeue

> Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp:115
> +                    audioBus->setChannelMemory(i, (float*)buffers[i]->data(), framesToProcess);

static_cast<float*>
Comment 5 Chris Dumez 2020-10-13 13:24:32 PDT
Created attachment 411245 [details]
Patch
Comment 6 Peng Liu 2020-10-13 13:32:38 PDT
Comment on attachment 411245 [details]
Patch

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

> Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp:46
> +constexpr size_t fifoSize = 96 * WebCore::AudioUtilities::renderQuantumSize;

Could you explain how did you choose the number 96? Thanks!

> Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp:87
>      void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t framesToProcess, const WebCore::AudioIOPosition& outputPosition) override

Nit. Looks like "sourceBus" is not used?

> Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp:140
> +    WebCore::PushPullFIFO m_fifo;

I like this change!
Comment 7 Chris Dumez 2020-10-13 13:33:48 PDT
(In reply to Peng Liu from comment #6)
> Comment on attachment 411245 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=411245&action=review
> 
> > Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp:46
> > +constexpr size_t fifoSize = 96 * WebCore::AudioUtilities::renderQuantumSize;
> 
> Could you explain how did you choose the number 96? Thanks!

Oh, I used the same size as the fifo queue in AudioDestinationCocoa.mm. I will add a comment.

> 
> > Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp:87
> >      void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t framesToProcess, const WebCore::AudioIOPosition& outputPosition) override
> 
> Nit. Looks like "sourceBus" is not used?
> 
> > Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp:140
> > +    WebCore::PushPullFIFO m_fifo;
> 
> I like this change!
Comment 8 Chris Dumez 2020-10-13 13:36:24 PDT
Created attachment 411247 [details]
Patch
Comment 9 EWS 2020-10-13 14:53:27 PDT
Committed r268423: <https://trac.webkit.org/changeset/268423>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 411247 [details].
Comment 10 Radar WebKit Bug Importer 2020-10-13 14:54:18 PDT
<rdar://problem/70267708>