Title: [276711] releases/WebKitGTK/webkit-2.32/Source/WebCore
Revision
276711
Author
[email protected]
Date
2021-04-28 07:33:39 -0700 (Wed, 28 Apr 2021)

Log Message

Merge r275596 - [GStreamer] Only seek to change the rate un updatePlaybackRate() when needed
https://bugs.webkit.org/show_bug.cgi?id=224235

Reviewed by Alicia Boya Garcia.

A seek is used by MediaPlayerPrivateGStreamer to update the playback
rate used in the pipeline. There's a special case when the rate is 0.0.
This actually means "paused" and, when set, the pipeline is changed to
PAUSED and no updatePlaybackRate() call is made because of an early
return (and therefore, no seek). When the rate is restored to a
non-zero value, the pipeline is set again to PLAYING, but a
call to updatePlaybackRate() is done, which implies an unconditional
seek.

It should be possible to do the seek in updatePlaybackRate() only if the
rate changed with respect to the original one, instead of always doing
it. This would avoid unneeded seeks, which are complex operations that
can trigger collateral issues such as the one addressed in
https://bugs.webkit.org/show_bug.cgi?id=223742.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate): Only seek when the playback rate hasn't changed.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Document m_lastPlaybackRate purpose.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog (276710 => 276711)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-04-28 14:31:40 UTC (rev 276710)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-04-28 14:33:39 UTC (rev 276711)
@@ -1,3 +1,29 @@
+2021-04-07  Enrique Ocaña González  <[email protected]>
+
+        [GStreamer] Only seek to change the rate un updatePlaybackRate() when needed
+        https://bugs.webkit.org/show_bug.cgi?id=224235
+
+        Reviewed by Alicia Boya Garcia.
+
+        A seek is used by MediaPlayerPrivateGStreamer to update the playback
+        rate used in the pipeline. There's a special case when the rate is 0.0.
+        This actually means "paused" and, when set, the pipeline is changed to
+        PAUSED and no updatePlaybackRate() call is made because of an early
+        return (and therefore, no seek). When the rate is restored to a
+        non-zero value, the pipeline is set again to PLAYING, but a
+        call to updatePlaybackRate() is done, which implies an unconditional
+        seek.
+
+        It should be possible to do the seek in updatePlaybackRate() only if the
+        rate changed with respect to the original one, instead of always doing
+        it. This would avoid unneeded seeks, which are complex operations that
+        can trigger collateral issues such as the one addressed in
+        https://bugs.webkit.org/show_bug.cgi?id=223742.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate): Only seek when the playback rate hasn't changed.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Document m_lastPlaybackRate purpose.
+
 2021-04-09  Philippe Normand  <[email protected]>
 
         Unreviewed, GStreamer Thunder decryptor build fix after r275599

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (276710 => 276711)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-04-28 14:31:40 UTC (rev 276710)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2021-04-28 14:33:39 UTC (rev 276711)
@@ -561,12 +561,14 @@
 
     GST_INFO_OBJECT(pipeline(), mute ? "Need to mute audio" : "Do not need to mute audio");
 
-    if (doSeek(playbackPosition(), m_playbackRate, static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH))) {
-        g_object_set(m_pipeline.get(), "mute", mute, nullptr);
-        m_lastPlaybackRate = m_playbackRate;
-    } else {
-        GST_ERROR_OBJECT(pipeline(), "Set rate to %f failed", m_playbackRate);
-        m_playbackRate = m_lastPlaybackRate;
+    if (m_lastPlaybackRate != m_playbackRate) {
+        if (doSeek(playbackPosition(), m_playbackRate, static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH))) {
+            g_object_set(m_pipeline.get(), "mute", mute, nullptr);
+            m_lastPlaybackRate = m_playbackRate;
+        } else {
+            GST_ERROR_OBJECT(pipeline(), "Set rate to %f failed", m_playbackRate);
+            m_playbackRate = m_lastPlaybackRate;
+        }
     }
 
     if (m_isPlaybackRatePaused) {

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (276710 => 276711)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2021-04-28 14:31:40 UTC (rev 276710)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2021-04-28 14:33:39 UTC (rev 276711)
@@ -461,6 +461,7 @@
     int m_mediaLocationCurrentIndex { 0 };
     bool m_isPlaybackRatePaused { false };
     MediaTime m_timeOfOverlappingSeek;
+    // Last playback rate sent through a GStreamer seek.
     float m_lastPlaybackRate { 1 };
     Timer m_fillTimer;
     MediaTime m_maxTimeLoaded;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to