Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8832caecee747939ab5236aee3174fafd8f1506d
https://github.com/WebKit/WebKit/commit/8832caecee747939ab5236aee3174fafd8f1506d
Author: Jean-Yves Avenard <[email protected]>
Date: 2026-06-15 (Mon, 15 Jun 2026)
Changed paths:
M Source/WebCore/platform/graphics/AudioVideoRenderer.h
M Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.h
M Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.mm
M
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
M
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
M Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.h
M Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm
M Source/WebKit/GPUProcess/media/RemoteAudioVideoRendererProxyManager.cpp
M Source/WebKit/GPUProcess/media/RemoteAudioVideoRendererProxyManager.h
M
Source/WebKit/GPUProcess/media/RemoteAudioVideoRendererProxyManager.messages.in
M Source/WebKit/WebProcess/GPU/media/AudioVideoRendererRemote.cpp
M Source/WebKit/WebProcess/GPU/media/AudioVideoRendererRemote.h
M
Source/WebKit/WebProcess/GPU/media/AudioVideoRendererRemoteMessageReceiver.messages.in
Log Message:
-----------
Make notifyTimeReachedAndStall return a MediaTimePromise
https://bugs.webkit.org/show_bug.cgi?id=317112
rdar://problem/179681528
Reviewed by Jer Noble.
The previous interface — a fire-and-forget call paired with a separately
registered callback — could not maintain a 1:1 mapping between calls and
their notifications. The callback was invoked when the underlying boundary
time observer fired, but cancelTimeReachedAction / notifyTimeReachedAndStall
could replace the observer at any time:
1. notifyTimeReachedAndStall(t1) registers an observer at t1.
2. The synchronizer crosses t1, the observer block dispatches a stall
notification.
3. While the notification is in flight (cross-process IPC for the
remote case, or a queued main-thread block for the in-process case),
the caller invokes notifyTimeReachedAndStall(t2). The producer for
t1 is replaced by one for t2 before the in-flight notification
resolves.
4. The notification for t1 is delivered against the producer registered
for t2 — a stall is reported at the wrong time, or the t2 observer
is silently dropped.
Convert the API to return Ref<MediaTimePromise>. Each call now owns its
own producer; later calls implicitly cancel the prior promise (rejecting
it with PlatformMediaError::Cancelled) before installing a new one. The
boundary observer captures and resolves a specific producer, so a stale
notification can never resolve a newer call's promise. The IPC variant
collapses StallTimeReached into the reply of the originating message,
ensuring the in-flight reply is the only resolution path and that
cancellation tears it down deterministically.
This fixes an intermittent failure observed when running
imported/w3c/web-platform-tests/media-source/mediasource-duration.html
Covered by existing tests.
* Source/WebCore/platform/graphics/AudioVideoRenderer.h:
(WebCore::TracksRendererManager::notifyTimeReachedAndStall):
* Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.mm:
(WebCore::AudioVideoRendererAVFObjC::notifyTimeReachedAndStall):
(WebCore::AudioVideoRendererAVFObjC::cancelTimeReachedAction):
*
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
*
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::resetStallForTime):
* Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.h:
* Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm:
(WebCore::MediaPlayerPrivateWebM::MediaPlayerPrivateWebM):
(WebCore::MediaPlayerPrivateWebM::setDuration):
* Source/WebKit/GPUProcess/media/RemoteAudioVideoRendererProxyManager.cpp:
(WebKit::RemoteAudioVideoRendererProxyManager::notifyTimeReachedAndStall):
* Source/WebKit/GPUProcess/media/RemoteAudioVideoRendererProxyManager.h:
*
Source/WebKit/GPUProcess/media/RemoteAudioVideoRendererProxyManager.messages.in:
* Source/WebKit/WebProcess/GPU/media/AudioVideoRendererRemote.cpp:
(WebKit::AudioVideoRendererRemote::AudioVideoRendererRemote):
(WebKit::AudioVideoRendererRemote::notifyTimeReachedAndStall):
(WebKit::AudioVideoRendererRemote::cancelTimeReachedAction):
(WebKit::AudioVideoRendererRemote::MessageReceiver::stallTimeReached): Deleted.
* Source/WebKit/WebProcess/GPU/media/AudioVideoRendererRemote.h:
*
Source/WebKit/WebProcess/GPU/media/AudioVideoRendererRemoteMessageReceiver.messages.in:
Canonical link: https://commits.webkit.org/315262@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications