Modified: trunk/Source/WebCore/ChangeLog (234982 => 234983)
--- trunk/Source/WebCore/ChangeLog 2018-08-17 13:19:19 UTC (rev 234982)
+++ trunk/Source/WebCore/ChangeLog 2018-08-17 14:07:33 UTC (rev 234983)
@@ -1,3 +1,20 @@
+2018-08-17 Philippe Normand <ph...@igalia.com>
+
+ [GStreamer] reduce position queries frequency
+ https://bugs.webkit.org/show_bug.cgi?id=188645
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ There is no need to perform dozens of position queries per second.
+ One every 300ms is enough.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
+ (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
+ (WebCore::MediaPlayerPrivateGStreamer::asyncStateChangeDone):
+ (WebCore::MediaPlayerPrivateGStreamer::updateStates):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+
2018-08-17 Michael Catanzaro <mcatanz...@igalia.com>
[SOUP] Handle OAuth authentication after r234912
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (234982 => 234983)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2018-08-17 13:19:19 UTC (rev 234982)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2018-08-17 14:07:33 UTC (rev 234983)
@@ -47,6 +47,7 @@
#include <wtf/MediaTime.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/StringPrintStream.h>
+#include <wtf/WallTime.h>
#include <wtf/glib/GUniquePtr.h>
#include <wtf/glib/RunLoopSourcePriority.h>
#include <wtf/text/CString.h>
@@ -131,6 +132,7 @@
: MediaPlayerPrivateGStreamerBase(player)
, m_buffering(false)
, m_bufferingPercentage(0)
+ , m_cachedPosition(MediaTime::invalidTime())
, m_canFallBackToLastFinishedSeekPosition(false)
, m_changingRate(false)
, m_downloadFinished(false)
@@ -162,6 +164,7 @@
, m_readyTimerHandler(RunLoop::main(), this, &MediaPlayerPrivateGStreamer::readyTimerFired)
, m_totalBytes(0)
, m_preservesPitch(false)
+ , m_lastQuery(-1)
{
#if USE(GLIB)
m_readyTimerHandler.setPriority(G_PRIORITY_DEFAULT_IDLE);
@@ -341,6 +344,12 @@
if (m_isEndReached && m_seeking)
return m_seekTime;
+ double now = WTF::WallTime::now().secondsSinceEpoch().milliseconds();
+ if (m_lastQuery > -1 && ((now - m_lastQuery) < 300) && m_cachedPosition.isValid())
+ return m_cachedPosition;
+
+ m_lastQuery = now;
+
// Position is only available if no async state change is going on and the state is either paused or playing.
gint64 position = GST_CLOCK_TIME_NONE;
GstQuery* query = gst_query_new_position(GST_FORMAT_TIME);
@@ -348,7 +357,7 @@
gst_query_parse_position(query, 0, &position);
gst_query_unref(query);
- GST_LOG("Position %" GST_TIME_FORMAT, GST_TIME_ARGS(position));
+ GST_TRACE_OBJECT(pipeline(), "Position %" GST_TIME_FORMAT, GST_TIME_ARGS(position));
MediaTime playbackPosition = MediaTime::zeroTime();
GstClockTime gstreamerPosition = static_cast<GstClockTime>(position);
@@ -357,6 +366,7 @@
else if (m_canFallBackToLastFinishedSeekPosition)
playbackPosition = m_seekTime;
+ m_cachedPosition = playbackPosition;
return playbackPosition;
}
@@ -1828,6 +1838,7 @@
else {
GST_DEBUG("[Seek] seeked to %s", toString(m_seekTime).utf8().data());
m_seeking = false;
+ m_cachedPosition = MediaTime::invalidTime();
if (m_timeOfOverlappingSeek != m_seekTime && m_timeOfOverlappingSeek.isValid()) {
seek(m_timeOfOverlappingSeek);
m_timeOfOverlappingSeek = MediaTime::invalidTime();
@@ -2007,8 +2018,10 @@
GST_DEBUG("[Seek] committing pending seek to %s", toString(m_seekTime).utf8().data());
m_seekIsPending = false;
m_seeking = doSeek(m_seekTime, m_player->rate(), static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE));
- if (!m_seeking)
+ if (!m_seeking) {
+ m_cachedPosition = MediaTime::invalidTime();
GST_DEBUG("[Seek] seeking to %s failed", toString(m_seekTime).utf8().data());
+ }
}
}
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (234982 => 234983)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2018-08-17 13:19:19 UTC (rev 234982)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h 2018-08-17 14:07:33 UTC (rev 234983)
@@ -257,6 +257,7 @@
mutable unsigned long long m_totalBytes;
URL m_url;
bool m_preservesPitch;
+ mutable double m_lastQuery;
bool m_isLegacyPlaybin;
#if GST_CHECK_VERSION(1, 10, 0)
GRefPtr<GstStreamCollection> m_streamCollection;