Skip to content

Commit

Permalink
RemoteRealtimeMediaSourceProxy::whenReady should support more than on…
Browse files Browse the repository at this point in the history
…e callback

https://bugs.webkit.org/show_bug.cgi?id=265236
rdar://118709394

Reviewed by Jean-Yves Avenard.

CoreAudioCaptureSource::whenReady can support being called more than once.
Given this and given the name (whenReady), we should also have RemoteRealtimeMediaSourceProxy::whenReady handle this.

* Source/WebKit/WebProcess/cocoa/RemoteRealtimeMediaSourceProxy.cpp:
(WebKit::RemoteRealtimeMediaSourceProxy::whenReady):

Canonical link: https://commits.webkit.org/271073@main
  • Loading branch information
youennf committed Nov 23, 2023
1 parent 25af3c2 commit e7ce012
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ void RemoteRealtimeMediaSourceProxy::whenReady(CompletionHandler<void(WebCore::C
if (m_isReady)
return callback(WebCore::CaptureSourceError(m_failureReason));

if (m_callback) {
callback = [previousCallbacks = std::exchange(m_callback, { }), newCallback = WTFMove(callback)] (auto&& error) mutable {
previousCallbacks(WebCore::CaptureSourceError { error });
newCallback(WTFMove(error));
};
}

m_callback = WTFMove(callback);
}

Expand Down

0 comments on commit e7ce012

Please sign in to comment.