Bug 218251

Summary: [GPUProcess] Use async IPC for RemoteAudioDestinationManager's StartAudioDestination / StopAudioDestination
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web AudioAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: calvaris, cdumez, darin, eric.carlson, ews-watchlist, ggaren, glenn, jer.noble, peng.liu6, philipj, pnormand, sam, sergio, vjaquez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 212611, 217606    
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2020-10-27 11:55:41 PDT
Use async IPC for RemoteAudioDestinationManager's StartAudioDestination / StopAudioDestination.
Comment 1 Peng Liu 2020-10-27 12:16:00 PDT
*** Bug 217990 has been marked as a duplicate of this bug. ***
Comment 2 Chris Dumez 2020-10-27 12:59:21 PDT
Created attachment 412454 [details]
Patch
Comment 3 Peng Liu 2020-10-27 13:38:32 PDT
Comment on attachment 412454 [details]
Patch

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

> Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp:132
> +            completionHandler(Exception { InvalidStateError, "Failed to start the audio device"_s });

Nit. Can be done in one line as in DefaultAudioDestinationNode::resume().

> Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp:148
> +        completionHandler(success ? WTF::nullopt : makeOptional(Exception { InvalidStateError, "Failed to start audio device"_s }));

Nit. Maybe we can use the same error message as in DefaultAudioDestinationNode::startRendering()?
s/"Failed to start audio device"_s/"Failed to start the audio device"_s/

> Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp:163
> +        completionHandler(success ? WTF::nullopt : makeOptional(Exception { InvalidStateError, "Failed to stop audio device"_s }));

Ditto. s/"Failed to stop audio device"_s/"Failed to stop the audio device"_s/

> Source/WebCore/platform/audio/cocoa/AudioDestinationCocoa.cpp:106
> +    auto success = !m_audioOutputUnitAdaptor.start();

Nit. OK as it is. Maybe "auto success = m_audioOutputUnitAdaptor.start() == noErr" is better?

> Source/WebCore/platform/audio/cocoa/AudioDestinationCocoa.cpp:118
> +    auto success = !m_audioOutputUnitAdaptor.stop();

Ditto.
Comment 4 Chris Dumez 2020-10-27 13:43:29 PDT
(In reply to Peng Liu from comment #3)
> Comment on attachment 412454 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=412454&action=review
> 
> > Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp:132
> > +            completionHandler(Exception { InvalidStateError, "Failed to start the audio device"_s });
> 
> Nit. Can be done in one line as in DefaultAudioDestinationNode::resume().
> 
> > Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp:148
> > +        completionHandler(success ? WTF::nullopt : makeOptional(Exception { InvalidStateError, "Failed to start audio device"_s }));
> 
> Nit. Maybe we can use the same error message as in
> DefaultAudioDestinationNode::startRendering()?
> s/"Failed to start audio device"_s/"Failed to start the audio device"_s/
> 
> > Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp:163
> > +        completionHandler(success ? WTF::nullopt : makeOptional(Exception { InvalidStateError, "Failed to stop audio device"_s }));
> 
> Ditto. s/"Failed to stop audio device"_s/"Failed to stop the audio device"_s/
> 
> > Source/WebCore/platform/audio/cocoa/AudioDestinationCocoa.cpp:106
> > +    auto success = !m_audioOutputUnitAdaptor.start();
> 
> Nit. OK as it is. Maybe "auto success = m_audioOutputUnitAdaptor.start() ==
> noErr" is better?
> 
> > Source/WebCore/platform/audio/cocoa/AudioDestinationCocoa.cpp:118
> > +    auto success = !m_audioOutputUnitAdaptor.stop();
> 
> Ditto.

Thanks for looking. I will fix all these shortly.
Comment 5 Chris Dumez 2020-10-27 13:46:03 PDT
Created attachment 412460 [details]
Patch
Comment 6 Geoffrey Garen 2020-10-27 13:54:33 PDT
Comment on attachment 412460 [details]
Patch

r=me
Comment 7 EWS 2020-10-27 14:46:26 PDT
Committed r269073: <https://trac.webkit.org/changeset/269073>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 412460 [details].
Comment 8 Radar WebKit Bug Importer 2020-10-27 14:47:21 PDT
<rdar://problem/70739259>