Skip to content

Commit 9b71229

Browse files
committed
[GStreamer] Premature finishSeek in progressive video
https://bugs.webkit.org/show_bug.cgi?id=287568 Reviewed by Philippe Normand. The MediaPlayerPrivateGStreamer::finishSeek() call is happening before the GStreamer seek completes, causing the JavaScript webpage to see the seek origin position on embedded systems with low CPU power (where seek takes more time to complete). This has been reproduced on Raspberry Pi using downstream wpe-2.38 and wpe-2.46, but I haven't been able to reproduce it on the main branch on desktop with a powerful computer. That doesn't mean that the problem isn't there. See: #1456 MediaPlayerPrivateGStreamer::doSeek() calls updateBufferingStatus(), which in turn calls updateStates(), which notifies the player of a readyState change and HTMLMediaElement::setReadyState() calls finishSeek(). This commit prevents the call to updateStates() from updateBufferingStatus() in this particular case. This doesn't cause any problem, since a new call to updateStates() will happen when the async state change in the GStreamer pipeline completes. * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::doSeek): Call updateBufferingStatus() with the shouldUpdateStates parameter set to false. (WebCore::MediaPlayerPrivateGStreamer::updateBufferingStatus): Added shouldUpdateStates parameter (defaults to true). * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Added shouldUpdateStates parameter to updateBufferingStatus(), with a default value of true.. Canonical link: https://commits.webkit.org/290339@main
1 parent 60b7dbc commit 9b71229

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ bool MediaPlayerPrivateGStreamer::doSeek(const MediaTime& position, float rate,
545545
quirksManager.resetBufferingPercentage(this, 0);
546546

547547
// Make sure that m_isBuffering is set to true, so that when buffering completes it's set to false again and playback resumes.
548-
updateBufferingStatus(GST_BUFFERING_STREAM, 0.0, true);
548+
updateBufferingStatus(GST_BUFFERING_STREAM, 0.0, true, false);
549549
changePipelineState(GST_STATE_PAUSED);
550550
}
551551

@@ -2214,7 +2214,7 @@ void MediaPlayerPrivateGStreamer::updateMaxTimeLoaded(double percentage)
22142214
GST_DEBUG_OBJECT(pipeline(), "[Buffering] Updated maxTimeLoaded: %s", toString(m_maxTimeLoaded).utf8().data());
22152215
}
22162216

2217-
void MediaPlayerPrivateGStreamer::updateBufferingStatus(GstBufferingMode mode, double percentage, bool resetHistory)
2217+
void MediaPlayerPrivateGStreamer::updateBufferingStatus(GstBufferingMode mode, double percentage, bool resetHistory, bool shouldUpdateStates)
22182218
{
22192219
m_wasBuffering = m_isBuffering;
22202220
m_previousBufferingPercentage = m_bufferingPercentage;
@@ -2280,7 +2280,8 @@ void MediaPlayerPrivateGStreamer::updateBufferingStatus(GstBufferingMode mode, d
22802280
m_previousBufferingPercentage = m_bufferingPercentage;
22812281
}
22822282
updateMaxTimeLoaded(percentage);
2283-
updateStates();
2283+
if (shouldUpdateStates)
2284+
updateStates();
22842285
GST_TRACE("[Buffering] Settled results: m_wasBuffering: %s, m_isBuffering: %s, m_previousBufferingPercentage: %d, m_bufferingPercentage: %d",
22852286
boolForPrinting(m_wasBuffering), boolForPrinting(m_isBuffering), m_previousBufferingPercentage, m_bufferingPercentage);
22862287
}

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface
542542

543543
virtual void updateDownloadBufferingFlag();
544544
void processBufferingStats(GstMessage*);
545-
void updateBufferingStatus(GstBufferingMode, double percentage, bool resetHistory = false);
545+
void updateBufferingStatus(GstBufferingMode, double percentage, bool resetHistory = false, bool shouldUpdateStates = true);
546546
void updateMaxTimeLoaded(double percentage);
547547

548548
#if USE(GSTREAMER_MPEGTS)

0 commit comments

Comments
 (0)