Bug 217704 - Add support for GPUProcess WebAudio media element providers
Summary: Add support for GPUProcess WebAudio media element providers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on: 217710
Blocks:
  Show dependency treegraph
 
Reported: 2020-10-14 05:44 PDT by youenn fablet
Modified: 2020-10-16 04:09 PDT (History)
13 users (show)

See Also:


Attachments
Patch (74.13 KB, patch)
2020-10-14 05:45 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (55.00 KB, patch)
2020-10-15 03:57 PDT, youenn fablet
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (55.10 KB, patch)
2020-10-15 05:02 PDT, youenn fablet
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (55.23 KB, patch)
2020-10-15 05:14 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (55.15 KB, patch)
2020-10-15 05:22 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (55.17 KB, patch)
2020-10-15 05:30 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (55.18 KB, patch)
2020-10-16 01:48 PDT, youenn fablet
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2020-10-14 05:44:16 PDT
Add support for GPUProcess WebAudio media element providers
Comment 1 youenn fablet 2020-10-14 05:45:31 PDT
Created attachment 411313 [details]
Patch
Comment 2 youenn fablet 2020-10-15 03:57:33 PDT
Created attachment 411422 [details]
Patch
Comment 3 youenn fablet 2020-10-15 05:02:48 PDT
Created attachment 411428 [details]
Patch
Comment 4 youenn fablet 2020-10-15 05:14:06 PDT
Created attachment 411430 [details]
Patch
Comment 5 youenn fablet 2020-10-15 05:22:58 PDT
Created attachment 411431 [details]
Patch
Comment 6 youenn fablet 2020-10-15 05:30:14 PDT
Created attachment 411432 [details]
Patch
Comment 7 Eric Carlson 2020-10-15 20:24:12 PDT
Comment on attachment 411432 [details]
Patch

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

> Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:345
> +    m_ringBuffer = m_ringBufferCallback ? m_ringBufferCallback(description, capacity) : nullptr;
> +    if (!m_ringBuffer) {
> +        m_ringBuffer = makeUnique<CARingBuffer>();
> +        m_ringBuffer->allocate(description, capacity);
> +    }

Is it possible for m_ringBufferCallback() to return NULL? If not, I would change this to something like 

if (m_ringBufferCallback)
    m_ringBuffer = m_ringBufferCallback(...)
else {
    m_ringBuffer = makeUnique<...>
    ...
}

> Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderCocoa.mm:144
> +    m_dataSource->pushSamples(MediaTime(m_writeCount, m_inputDescription->sampleRate()), data, frameCount);

Good catch!

> Source/WebKit/GPUProcess/media/RemoteAudioSourceProviderProxy.cpp:29
> +#if ENABLE(GPU_PROCESS) && ENABLE(WEB_AUDIO) && PLATFORM(COCOA)

`ENABLE_WEB_AUDIO` is defined in PlatformEnableCocoa.h, so I think `ENABLE(WEB_AUDIO) && PLATFORM(COCOA)` can be just `PLATFORM(COCOA)`

> Source/WebKit/GPUProcess/media/RemoteAudioSourceProviderProxy.h:28
> +#if ENABLE(GPU_PROCESS) && ENABLE(WEB_AUDIO) && PLATFORM(COCOA)

Ditto.

> Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp:889
> +#if ENABLE(WEB_AUDIO) && PLATFORM(COCOA)

Ditto.

> Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp:903
> +#if ENABLE(WEB_AUDIO) && PLATFORM(COCOA)

Ditto.

> Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h:314
> +#if ENABLE(WEB_AUDIO) && PLATFORM(COCOA)

Ditto.

> Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp:105
> +#if PLATFORM(COCOA) && ENABLE(WEB_AUDIO)

Ditto.

> Source/WebKit/WebProcess/GPU/GPUProcessConnection.h:70
> +#if PLATFORM(COCOA) && ENABLE(WEB_AUDIO)

Ditto.

> Source/WebKit/WebProcess/GPU/GPUProcessConnection.h:108
> +#if PLATFORM(COCOA) && ENABLE(WEB_AUDIO)

Ditto.

> Source/WebKit/WebProcess/GPU/media/RemoteAudioSourceProvider.cpp:29
>  #if ENABLE(GPU_PROCESS) && ENABLE(WEB_AUDIO) && PLATFORM(COCOA)

Ditto.

> Source/WebKit/WebProcess/cocoa/RemoteCaptureSampleManager.cpp:29
> +#include "Logging.h"

Is this needed?
Comment 8 youenn fablet 2020-10-16 01:34:02 PDT
(In reply to Eric Carlson from comment #7)
> Comment on attachment 411432 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=411432&action=review
> 
> > Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:345
> > +    m_ringBuffer = m_ringBufferCallback ? m_ringBufferCallback(description, capacity) : nullptr;
> > +    if (!m_ringBuffer) {
> > +        m_ringBuffer = makeUnique<CARingBuffer>();
> > +        m_ringBuffer->allocate(description, capacity);
> > +    }
> 
> Is it possible for m_ringBufferCallback() to return NULL? If not, I would
> change this to something like 
> 
> if (m_ringBufferCallback)
>     m_ringBuffer = m_ringBufferCallback(...)
> else {
>     m_ringBuffer = makeUnique<...>
>     ...
> }

I did that initially but thought it was as good this way.
I'll change the ring buffer callback to pass a UniqueRef.

> > Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderCocoa.mm:144
> > +    m_dataSource->pushSamples(MediaTime(m_writeCount, m_inputDescription->sampleRate()), data, frameCount);
> 
> Good catch!
> 
> > Source/WebKit/GPUProcess/media/RemoteAudioSourceProviderProxy.cpp:29
> > +#if ENABLE(GPU_PROCESS) && ENABLE(WEB_AUDIO) && PLATFORM(COCOA)
> 
> `ENABLE_WEB_AUDIO` is defined in PlatformEnableCocoa.h, so I think
> `ENABLE(WEB_AUDIO) && PLATFORM(COCOA)` can be just `PLATFORM(COCOA)`

CMake build is defining these macros in Source/cmake/OptionsXXX.cmake so it might be safer to keep these.

> > Source/WebKit/WebProcess/cocoa/RemoteCaptureSampleManager.cpp:29
> > +#include "Logging.h"
> 
> Is this needed?

Unified build issue.
Comment 9 youenn fablet 2020-10-16 01:48:15 PDT
Created attachment 411547 [details]
Patch for landing
Comment 10 EWS 2020-10-16 02:49:02 PDT
Committed r268577: <https://trac.webkit.org/changeset/268577>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 411547 [details].
Comment 11 Radar WebKit Bug Importer 2020-10-16 02:50:19 PDT
<rdar://problem/70371753>