Skip to content

Commit 4addea8

Browse files
committed
[MSE][GStreamer] Early reset m_isEndReached (EOS) when about to seek
https://bugs.webkit.org/show_bug.cgi?id=302160 Reviewed by NOBODY (OOPS!). 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: WebPlatformForEmbedded/WPEWebKit#1568 (comment) * 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().
1 parent bd08842 commit 4addea8

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ void MediaPlayerPrivateGStreamerMSE::pause()
174174
player->playbackStateChanged();
175175
}
176176

177+
void MediaPlayerPrivateGStreamerMSE::willSeekToTarget(const MediaTime& time)
178+
{
179+
MediaPlayerPrivateInterface::willSeekToTarget(time);
180+
// Don't consider the stream as EOS anymore after a seek.
181+
m_isEndReached = false;
182+
}
183+
177184
void MediaPlayerPrivateGStreamerMSE::checkPlayingConsistency()
178185
{
179186
MediaPlayerPrivateGStreamer::checkPlayingConsistency();

Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class MediaPlayerPrivateGStreamerMSE : public MediaPlayerPrivateGStreamer {
5656

5757
void play() override;
5858
void pause() override;
59+
void willSeekToTarget(const MediaTime&) override;
5960
void seekToTarget(const SeekTarget&) override;
6061
bool doSeek(const SeekTarget&, float rate, bool isAsync = false) override;
6162

0 commit comments

Comments
 (0)