Repository navigation
[GStreamer][MSE] Avoid spurious seek to 0 when seeking to end - #70855
Conversation
|
EWS run on previous version of this PR (hash 085f5f8) Details |
|
Typo: s/spureous/spurious/ |
085f5f8 to
f9a3423
Compare
|
EWS run on previous version of this PR (hash f9a3423) Details |
ntrrgc
left a comment
There was a problem hiding this comment.
I won't formally review this since this is code I wrote, but I can state it's consistent with the changes I was working with, which indeed fixed the accidental seek to end.
calvaris
left a comment
There was a problem hiding this comment.
changelog: "spureous" → "spurious"
There was a problem hiding this comment.
I think we should check for the duration to be > 0, otherwise we could be creating issues.
There was a problem hiding this comment.
If the duration is 0, how can the playback position go beyond it? Note that default duration, at least in MSE, is NaN. For regular playback, it's NaN when not available and Infinity for unbound streams. So, if it's actually zero, it must be for a good reason. And if it's indeed zero, that might also trigger the undesirable seek to 0 that we're trying to avoid, entering into a potential loop of seeks.
What kind of issues were you thinking about?
There was a problem hiding this comment.
Ok, ok, I see after our 1-1 chat:
Both MediaPlayerPrivateGStreamer::duration() and MediaPlayerPrivateGStreamerMSE::duration() use zero as a special case when the real duration is invalid (unknown). That's why the zero value must be had into account in this kind of conditions.
I'm adding your suggestion to the final version of the patch. Thanks! 🙏
f9a3423 to
272ed49
Compare
|
EWS run on current version of this PR (hash 272ed49) Details |
|
The failure detected by the merge queue is a flaky that is also happening on other merge attempts today and it's unrelated to the changes in this PR. Attempting merge-queue again. |
|
♻️ |
272ed49 to
2af23f0
Compare
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: WebPlatformForEmbedded/WPEWebKit#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
2af23f0 to
42a5b53
Compare
|
Committed 318859@main (42a5b53): https://commits.webkit.org/318859@main Reviewed commits have been landed. Closing PR #70855 and removing active labels. |
42a5b53
272ed49