[WebAudio] Implement AudioContext::outputLatency#38923
Conversation
|
EWS run on previous version of this PR (hash 508e4ab) Details |
508e4ab to
0ab4a63
Compare
|
EWS run on previous version of this PR (hash 0ab4a63) Details |
0ab4a63 to
c5d7ea4
Compare
|
EWS run on previous version of this PR (hash c5d7ea4) Details
|
c5d7ea4 to
f2267bb
Compare
|
EWS run on previous version of this PR (hash f2267bb) Details |
There was a problem hiding this comment.
I think you could go down this codepath in both cases (Minimal and Enhanced)
| if (noiseInjectionPolicies().contains(NoiseInjectionPolicy::Minimal)) | |
| if (noiseInjectionPolicies()) |
f2267bb to
088fb33
Compare
|
EWS run on previous version of this PR (hash 088fb33) Details |
There was a problem hiding this comment.
Would it be better to leave destination do this computation?
That way, we can do the computation in GPUProcess and remove the need to send to WebProcess the audio session latency.
There was a problem hiding this comment.
Doing so would require to have a way for the RemoteAudioDestination/RemoteAudioDestinationProxy be notified when the AudioSession changes. It's a much bigger change.
And currently the RemoteAudioSession in the WebContent is being notified of changes of AudioSession in the GPU process. So I re-used that.
it made the change much smaller.
I could move that arithmetic in the AudioDestination, but then it kind of blur which latency are we talking about. The AudioDestination itself, the AudioSession, both?
There was a problem hiding this comment.
I would prefer we would move the computation to the AudioDestination.
It is probably the audio destination that will handle setSinkId computation as well, so that seems better this way.
There was a problem hiding this comment.
I would tend to move this computation to AudioOuptutUnitAdaptor.
The reason is that AudioContext can be set to a particular device via setSinkId.
To handle the case of audio context playing on the device device and default device is changing, AudioOuptutUnitAdaptor would ideally be notified that the default device is changing and would do the recomputation if it is not set to a particular device via setSinkId.
And then send the updated value to its AudioOuptutUnitAdaptor client.
There was a problem hiding this comment.
We don't currently support setSinkId on the AudioContext so I will take this as a follow-up.
There was a problem hiding this comment.
I also don't see how we can retrieve the device's latency from the AudioUnit
youennf
left a comment
There was a problem hiding this comment.
r=me.
I would tend to have AudioDestination be the one to do the latency computation.
This eases handling the case of not playing context as well as future setSinkId case.
There was a problem hiding this comment.
It seems odd to return the audiosession latency even if AudioContext is not playing.
I'll tend to move the logic to add the latencies in destination.
There was a problem hiding this comment.
Limited it to when the context is playing
There was a problem hiding this comment.
I would prefer we would move the computation to the AudioDestination.
It is probably the audio destination that will handle setSinkId computation as well, so that seems better this way.
088fb33 to
6b74781
Compare
|
EWS run on previous version of this PR (hash 6b74781) Details |
6b74781 to
a575fca
Compare
|
EWS run on current version of this PR (hash a575fca) Details |
https://bugs.webkit.org/show_bug.cgi?id=285826 rdar://142794341 Reviewed by Youenn Fablet. Add implementation for Cocoa platforms, other platforms will return 0 for now. * LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt: * Source/WebCore/Modules/webaudio/AudioContext.cpp: (WebCore::AudioContext::outputLatency): * Source/WebCore/Modules/webaudio/AudioContext.h: * Source/WebCore/Modules/webaudio/AudioContext.idl: * Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.cpp: (WebCore::DefaultAudioDestinationNode::outputLatency const): * Source/WebCore/Modules/webaudio/DefaultAudioDestinationNode.h: * Source/WebCore/platform/audio/AudioDestination.h: (WebCore::AudioDestination::outputLatency const): * Source/WebCore/platform/audio/AudioSession.h: * Source/WebCore/platform/audio/SharedAudioDestination.cpp: (WebCore::SharedAudioDestinationAdapter::outputLatency const): (WebCore::SharedAudioDestinationAdapter::protectedDestination const): (WebCore::SharedAudioDestination::outputLatency const): (WebCore::SharedAudioDestination::protectedOutputAdapter const): (WebCore::SharedAudioDestinationAdapter::protectedDestination): Deleted. (WebCore::SharedAudioDestination::protectedOutputAdapter): Deleted. * Source/WebCore/platform/audio/SharedAudioDestination.h: * Source/WebCore/platform/audio/cocoa/AudioDestinationCocoa.cpp: (WebCore::AudioDestinationCocoa::outputLatency const): * Source/WebCore/platform/audio/cocoa/AudioDestinationCocoa.h: * Source/WebCore/platform/audio/cocoa/AudioOutputUnitAdaptor.cpp: (WebCore::AudioOutputUnitAdaptor::outputLatency const): * Source/WebCore/platform/audio/cocoa/AudioOutputUnitAdaptor.h: * Source/WebCore/platform/audio/ios/AudioSessionIOS.h: * Source/WebCore/platform/audio/ios/AudioSessionIOS.mm: (WebCore::AudioSessionIOS::outputLatency const): * Source/WebCore/platform/audio/mac/AudioSessionMac.h: * Source/WebCore/platform/audio/mac/AudioSessionMac.mm: (WebCore::AudioSessionMac::outputLatency const): * Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp: (WebKit::RemoteAudioDestinationManager::createAudioDestination): (WebKit::RemoteAudioDestinationManager::startAudioDestination): * Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.h: * Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.messages.in: * Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp: (WebKit::RemoteAudioSessionProxy::configuration): * Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp: (WebKit::RemoteAudioDestinationProxy::connection): (WebKit::RemoteAudioDestinationProxy::startRendering): (WebKit::RemoteAudioDestinationProxy::outputLatency const): * Source/WebKit/WebProcess/GPU/media/RemoteAudioDestinationProxy.h: * Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h: * Source/WebKit/WebProcess/GPU/media/RemoteAudioSessionConfiguration.h: * Source/WebKit/WebProcess/GPU/media/RemoteAudioSessionConfiguration.serialization.in: Canonical link: https://commits.webkit.org/288904@main
a575fca to
420f89a
Compare
|
Committed 288904@main (420f89a): https://commits.webkit.org/288904@main Reviewed commits have been landed. Closing PR #38923 and removing active labels. |
🧪 gtk-wk2
420f89a
a575fca
🛠 win🧪 wpe-wk2🧪 win-tests🧪 ios-wk2🧪 api-wpe🧪 api-ios🧪 mac-AS-debug-wk2🧪 gtk-wk2🧪 mac-intel-wk2🛠 playstation🛠 mac-safer-cpp🛠 watch-sim