Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a3af5da09b5c80d0d49bedc0528d3bc6947f4690
      
https://github.com/WebKit/WebKit/commit/a3af5da09b5c80d0d49bedc0528d3bc6947f4690
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2026-08-17 (Mon, 17 Aug 2026)

  Changed paths:
    A 
LayoutTests/media/media-source/media-managedmse-resume-after-seek-expected.txt
    A LayoutTests/media/media-source/media-managedmse-resume-after-seek.html
    M Source/WebCore/Modules/mediasource/MediaSource.cpp
    M Source/WebCore/platform/graphics/MediaSourcePrivate.cpp
    M Source/WebCore/platform/graphics/MediaSourcePrivate.h
    M Source/WebCore/platform/graphics/MediaSourcePrivateClient.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm

  Log Message:
  -----------
  REGRESSION(315668@main) ManagedMediaSource: "startstreaming" is not emitted 
when seeking
https://bugs.webkit.org/show_bug.cgi?id=321919
rdar://183790572

Reviewed by Eric Carlson.

315668@main moved the pending seek target from MediaSource to 
MediaSourcePrivate.

It regressed two things:
- monitorSourceBuffer() which caused the ManagedMediaSource to monitor the 
buffered range
and appropriately handled the start/stop streaming event stop being called.
- It called the MediaSourcePrivate's currentTime rather than the player's one.
The MediaSourcePrivateAVFObjC::currentTime() implementation returned the 
renderer's currentTime.
The currentTime returned by the renderer will only be the same as the pending 
seek time once
the render seek as started. But the seek will only start if there's sufficient
buffered data to continue the seek.

Due to the latter, when the ManagedMediaSource's monitorSourceBuffer algoritm 
ran
it read the renderer's time before seek started which was always buffered
and so no startstreaming event needed firing.

HLS.js player is waiting for that event to be fired before appending data
and so seek never completed (it was never started).

MediaSourcePrivate::currentTime() is no longer virtual: it keeps the pending
seek target check and delegates to a new protected platformCurrentTime(), which
carries the thread-safety requirement the platform implementations need, so an
override can no longer drop the pending target. MediaSourcePrivateAVFObjC
overrides platformCurrentTime() and still reads the renderer, which is the only
source of time it can use off the main thread.
We also add in MediaSourcePrivate::waitForTarget() a call to monitorSourceBuffer
when data isn't buffered to ensure startstreaming is fired.

Added a new test.

* 
LayoutTests/media/media-source/media-managedmse-resume-after-seek-expected.txt: 
Added.
* LayoutTests/media/media-source/media-managedmse-resume-after-seek.html: Added.
* Source/WebCore/Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSourceClientImpl::monitorSourceBuffers): Run the algorithm on 
the MediaSource's thread.
* Source/WebCore/platform/graphics/MediaSourcePrivate.cpp:
(WebCore::MediaSourcePrivate::waitForTarget): Ask the client to monitor the 
source buffers when the target isn't buffered.
(WebCore::MediaSourcePrivate::currentTime const): Return the pending seek 
target, otherwise the platform's time.
(WebCore::MediaSourcePrivate::platformCurrentTime const): Moved from 
currentTime().
* Source/WebCore/platform/graphics/MediaSourcePrivate.h:
* Source/WebCore/platform/graphics/MediaSourcePrivateClient.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
(WebCore::MediaSourcePrivateAVFObjC::platformCurrentTime const): Renamed from 
currentTime().

Canonical link: https://commits.webkit.org/319330@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to