Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4b36b57f526142f82a46e3ca116a25454e7b73e3
      
https://github.com/WebKit/WebKit/commit/4b36b57f526142f82a46e3ca116a25454e7b73e3
  Author: Enrique Ocaña González <[email protected]>
  Date:   2025-11-18 (Tue, 18 Nov 2025)

  Changed paths:
    M 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
    M 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h

  Log Message:
  -----------
  [MSE][GStreamer] Early reset m_isEndReached (EOS) when about to seek
https://bugs.webkit.org/show_bug.cgi?id=302160

Reviewed by Alicia Boya Garcia.

This specific issue related to seek after EOS was seen downstream:

1. EOS is reached: m_isEndReached becomes true. HTMLMediaElement marks
   itself as paused. It also transitions to HaveCurrentData as a result
   of the EOS, which pauses the GStreamer pipeline.

2. Seek from JS occurs: A seek in HTMLMediaElement coming from the DOM
   does the following:

2.1. Synchronously sets m_lastSeekTime (which is read by
     MediaSource::currentTime()).

2.2. Synchronously calls MediaPlayerPrivate::willSeekToTarget().

2.3. Schedules an asynchronous call to
     MediaPlayerPrivate::seekToTarget() which hasn't happened yet.

3. monitorSourceBuffers() notices the new currentTime (i.e. the seek
   target time) is in the buffered ranges and therefore upgrades ready
   state to HaveEnoughData:

   The GStreamer player reacts and the pipeline is now set to PLAYING,
   but critically, because m_isEndReached hasn't been reset yet,
   paused() returns still true.

   From now on until the completion of the seek we are in an invalid
   state where the multiplatform code will (reasonably) assume its
   request to play has been honored and that the if our player is
   paused, that has been intentionally done for some platform specific
   reason, which it will try to synchronize to, preventing playback from
   resuming.

   Clearing m_isEndReached synchronously fixes the race.

This change resets m_isEndReached as soon as possible (on
willSeekToTarget()), so the seek can happen.

See: 
https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/1568#issuecomment-3448502697

* 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::willSeekToTarget): Reset 
m_isEndReached as soon as we know that a seek will happen.
* 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
 Override willSeekToTarget().

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



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

Reply via email to