Title: [202558] trunk
Revision
202558
Author
[email protected]
Date
2016-06-28 04:26:07 -0700 (Tue, 28 Jun 2016)

Log Message

[GStreamer] usec rounding is wrong during accurate seeking
https://bugs.webkit.org/show_bug.cgi?id=90734

Reviewed by Carlos Garcia Campos.

Use floor() to round the microseconds value, this is more robust
than roundf.

* platform/graphics/gstreamer/GStreamerUtilities.cpp:
(WebCore::toGstClockTime):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition):

Modified Paths

Diff

Modified: trunk/LayoutTests/platform/gtk/media/video-frame-accurate-seek-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (202557 => 202558)


--- trunk/Source/WebCore/ChangeLog	2016-06-28 11:24:15 UTC (rev 202557)
+++ trunk/Source/WebCore/ChangeLog	2016-06-28 11:26:07 UTC (rev 202558)
@@ -1,5 +1,20 @@
 2016-06-28  Philippe Normand  <[email protected]>
 
+        [GStreamer] usec rounding is wrong during accurate seeking
+        https://bugs.webkit.org/show_bug.cgi?id=90734
+
+        Reviewed by Carlos Garcia Campos.
+
+        Use floor() to round the microseconds value, this is more robust
+        than roundf.
+
+        * platform/graphics/gstreamer/GStreamerUtilities.cpp:
+        (WebCore::toGstClockTime):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::playbackPosition):
+
+2016-06-28  Philippe Normand  <[email protected]>
+
         [GStreamer] improved duration query support in the HTTP source element
         https://bugs.webkit.org/show_bug.cgi?id=159204
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp (202557 => 202558)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp	2016-06-28 11:24:15 UTC (rev 202557)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp	2016-06-28 11:26:07 UTC (rev 202558)
@@ -182,7 +182,7 @@
     float microSeconds = modff(time, &seconds) * 1000000;
     GTimeVal timeValue;
     timeValue.tv_sec = static_cast<glong>(seconds);
-    timeValue.tv_usec = static_cast<glong>(roundf(microSeconds / 10000) * 10000);
+    timeValue.tv_usec = static_cast<glong>(floor(microSeconds + 0.5));
     return GST_TIMEVAL_TO_TIME(timeValue);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (202557 => 202558)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2016-06-28 11:24:15 UTC (rev 202557)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2016-06-28 11:26:07 UTC (rev 202558)
@@ -309,17 +309,18 @@
     GstQuery* query= gst_query_new_position(GST_FORMAT_TIME);
     if (gst_element_query(m_pipeline.get(), query))
         gst_query_parse_position(query, 0, &position);
+    gst_query_unref(query);
 
+    LOG_MEDIA_MESSAGE("Position %" GST_TIME_FORMAT, GST_TIME_ARGS(position));
+
     float result = 0.0f;
-    if (static_cast<GstClockTime>(position) != GST_CLOCK_TIME_NONE)
-        result = static_cast<double>(position) / GST_SECOND;
-    else if (m_canFallBackToLastFinishedSeekPosition)
+    if (static_cast<GstClockTime>(position) != GST_CLOCK_TIME_NONE) {
+        GTimeVal timeValue;
+        GST_TIME_TO_TIMEVAL(position, timeValue);
+        result = static_cast<float>(timeValue.tv_sec + (timeValue.tv_usec / 1000000.0));
+    } else if (m_canFallBackToLastFinishedSeekPosition)
         result = m_seekTime;
 
-    LOG_MEDIA_MESSAGE("Position %" GST_TIME_FORMAT, GST_TIME_ARGS(position));
-
-    gst_query_unref(query);
-
     return result;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to