Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 42a5b5300e3d05ac9a9274479d118958892a9508
https://github.com/WebKit/WebKit/commit/42a5b5300e3d05ac9a9274479d118958892a9508
Author: Alicia Boya Garcia <[email protected]>
Date: 2026-08-09 (Sun, 09 Aug 2026)
Changed paths:
A
LayoutTests/media/media-source/media-source-seek-to-end-doesnt-loop-expected.txt
A LayoutTests/media/media-source/media-source-seek-to-end-doesnt-loop.html
M Source/WebCore/html/HTMLMediaElement.cpp
M Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
M
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
Log Message:
-----------
[GStreamer][MSE] Avoid spurious seek to 0 when seeking to end
https://bugs.webkit.org/show_bug.cgi?id=320981
Reviewed by Xabier Rodriguez-Calvar.
On a device where a GStreamer seek operation leads to a pipeline async
state change, we may enter a flow of internal calls that cause a second
seek to zero to be executed before the first call has returned. This was
detected with Spotify when performing a seek to the asset end (duration)
right after playback has started from the beginning (position zero).
This issue does not happen if the GStreamer seek operation does not
cause a async pipeline state change.
See: https://github.com/WebPlatformForEmbedded/WPEWebKit/issues/1645
This patch avoids automatic playback when the video has ended
(effectively helping to avoid currentTime accidentally going beyond the
duration) or when a seek is still happening (avoiding currentTime to
progress and change the conditions of the video). ReadyState is
propagated to the player when seek has completed, helping the
HTMLMediaElement algorithms to take the right decisions when seek
completes. Finally, code has been added to avoid the position to ever go
beyond the duration in order to avoid a degradation of the ReadyState to
HaveMetadata, except when the duration is zero. This is a special case
used by MediaPlayerPrivateGStreamer::duration() and
MediaPlayerPrivateGStreamerMSE::duration() when the duration is
unknown/unavailable, and we don't want to mess up with that and cause a
stream that is just being loaded to trigger unexpected effects.
Co-authored-by: Enrique Ocaña González <[email protected]>
Test: media/media-source/media-source-seek-to-end-doesnt-loop.html
*
LayoutTests/media/media-source/media-source-seek-to-end-doesnt-loop-expected.txt:
Added.
* LayoutTests/media/media-source/media-source-seek-to-end-doesnt-loop.html:
Added.
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged): Avoid automatic
playback on seek or video end.
* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Never allow the
position to go beyond duration, except in the special case when duration is
zero.
*
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::doSeek): Propagate readyState to
player on seek completion.
(WebCore::MediaPlayerPrivateGStreamerMSE::propagateReadyStateToPlayer): Relaxed
the assert so also admit m_isSeeking as a condition to not halt execution.
Canonical link: https://commits.webkit.org/318859@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications