Commit 63163ca6 authored by philn@webkit.org's avatar philn@webkit.org

2011-03-10 Philippe Normand <pnormand@igalia.com>

        Reviewed by Martin Robinson.

        [GStreamer] Frame accurate seeking isn't always accurate
        https://bugs.webkit.org/show_bug.cgi?id=55217

        Attempt to build the seek GstClockTime position by converting the
        float time value to a GTimeVal value rounded at microsecond
        precision. Additionally perform the seek with the ACCURATE seek
        flag. These modifications at least fix this manual-test:
        http://www.massive-interactive.nl/html5_video/smpte_test_universal.html

        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::MediaPlayerPrivateGStreamer::currentTime):
        (WebCore::MediaPlayerPrivateGStreamer::seek):
        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

git-svn-id: svn://svn.chromium.org/blink/trunk@81228 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0a84cb5f
2011-03-10 Philippe Normand <pnormand@igalia.com>
Reviewed by Martin Robinson.
[GStreamer] Frame accurate seeking isn't always accurate
https://bugs.webkit.org/show_bug.cgi?id=55217
Attempt to build the seek GstClockTime position by converting the
float time value to a GTimeVal value rounded at microsecond
precision. Additionally perform the seek with the ACCURATE seek
flag. These modifications at least fix this manual-test:
http://www.massive-interactive.nl/html5_video/smpte_test_universal.html
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::currentTime):
(WebCore::MediaPlayerPrivateGStreamer::seek):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2011-03-15 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
......
......@@ -495,7 +495,7 @@ float MediaPlayerPrivateGStreamer::currentTime() const
return 0.0f;
if (m_seeking)
return static_cast<float>(m_seekTime);
return m_seekTime;
return playbackPosition(m_playBin);
......@@ -513,17 +513,28 @@ void MediaPlayerPrivateGStreamer::seek(float time)
if (m_errorOccured)
return;
GstClockTime sec = (GstClockTime)(static_cast<float>(time * GST_SECOND));
LOG_VERBOSE(Media, "Seek: %" GST_TIME_FORMAT, GST_TIME_ARGS(sec));
// Extract the integer part of the time (seconds) and the
// fractional part (microseconds). Attempt to round the
// microseconds so no floating point precision is lost and we can
// perform an accurate seek.
float seconds;
float microSeconds = modf(time, &seconds) * 1000000;
GTimeVal timeValue;
timeValue.tv_sec = static_cast<glong>(seconds);
timeValue.tv_usec = static_cast<glong>(roundf(microSeconds / 10000) * 10000);
GstClockTime clockTime = GST_TIMEVAL_TO_TIME(timeValue);
LOG_VERBOSE(Media, "Seek: %" GST_TIME_FORMAT, GST_TIME_ARGS(clockTime));
if (!gst_element_seek(m_playBin, m_player->rate(),
GST_FORMAT_TIME,
(GstSeekFlags)(GST_SEEK_FLAG_FLUSH),
GST_SEEK_TYPE_SET, sec,
(GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
GST_SEEK_TYPE_SET, clockTime,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE))
LOG_VERBOSE(Media, "Seek to %f failed", time);
else {
m_seeking = true;
m_seekTime = sec;
m_seekTime = time;
}
}
......
......@@ -161,7 +161,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
GstElement* m_videoSinkBin;
GstElement* m_fpsSink;
GstElement* m_source;
GstClockTime m_seekTime;
float m_seekTime;
bool m_changingRate;
float m_endTime;
bool m_isEndReached;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment