Changeset 202558 in webkit


Ignore:
Timestamp:
Jun 28, 2016 4:26:07 AM (8 years ago)
Author:
Philippe Normand
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):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202556 r202558  
     12016-06-28  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] usec rounding is wrong during accurate seeking
     4        https://bugs.webkit.org/show_bug.cgi?id=90734
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Use floor() to round the microseconds value, this is more robust
     9        than roundf.
     10
     11        * platform/graphics/gstreamer/GStreamerUtilities.cpp:
     12        (WebCore::toGstClockTime):
     13        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     14        (WebCore::MediaPlayerPrivateGStreamer::playbackPosition):
     15
    1162016-06-28  Philippe Normand  <pnormand@igalia.com>
    217
  • trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp

    r201163 r202558  
    183183    GTimeVal timeValue;
    184184    timeValue.tv_sec = static_cast<glong>(seconds);
    185     timeValue.tv_usec = static_cast<glong>(roundf(microSeconds / 10000) * 10000);
     185    timeValue.tv_usec = static_cast<glong>(floor(microSeconds + 0.5));
    186186    return GST_TIMEVAL_TO_TIME(timeValue);
    187187}
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r202272 r202558  
    310310    if (gst_element_query(m_pipeline.get(), query))
    311311        gst_query_parse_position(query, 0, &position);
     312    gst_query_unref(query);
     313
     314    LOG_MEDIA_MESSAGE("Position %" GST_TIME_FORMAT, GST_TIME_ARGS(position));
    312315
    313316    float result = 0.0f;
    314     if (static_cast<GstClockTime>(position) != GST_CLOCK_TIME_NONE)
    315         result = static_cast<double>(position) / GST_SECOND;
    316     else if (m_canFallBackToLastFinishedSeekPosition)
     317    if (static_cast<GstClockTime>(position) != GST_CLOCK_TIME_NONE) {
     318        GTimeVal timeValue;
     319        GST_TIME_TO_TIMEVAL(position, timeValue);
     320        result = static_cast<float>(timeValue.tv_sec + (timeValue.tv_usec / 1000000.0));
     321    } else if (m_canFallBackToLastFinishedSeekPosition)
    317322        result = m_seekTime;
    318 
    319     LOG_MEDIA_MESSAGE("Position %" GST_TIME_FORMAT, GST_TIME_ARGS(position));
    320 
    321     gst_query_unref(query);
    322323
    323324    return result;
Note: See TracChangeset for help on using the changeset viewer.