diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index f2bd29259..736fd5a06 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -74,10 +74,17 @@ typedef enum { GST_PLAY_FLAG_BUFFERING = 0x000000100 } GstPlayFlags; +// gPercentMax is used when parsing buffering ranges with +// gst_query_parse_nth_buffering_range as there was a bug in GStreamer +// 0.10 that was using 100 instead of GST_FORMAT_PERCENT_MAX. This was +// corrected in 1.0. gst_query_parse_buffering_range worked as +// expected with GST_FORMAT_PERCENT_MAX in both cases. #ifdef GST_API_VERSION_1 static const char* gPlaybinName = "playbin"; +static const gint64 gPercentMax = GST_FORMAT_PERCENT_MAX; #else static const char* gPlaybinName = "playbin2"; +static const gint64 gPercentMax = 100; #endif GST_DEBUG_CATEGORY_STATIC(webkit_media_player_debug); @@ -749,11 +756,11 @@ PassRefPtr<TimeRanges> MediaPlayerPrivateGStreamer::buffered() const return timeRanges.release(); } - gint64 rangeStart = 0, rangeStop = 0; for (guint index = 0; index < gst_query_get_n_buffering_ranges(query); index++) { + gint64 rangeStart = 0, rangeStop = 0; if (gst_query_parse_nth_buffering_range(query, index, &rangeStart, &rangeStop)) - timeRanges->add(static_cast<float>((rangeStart * mediaDuration) / 100), - static_cast<float>((rangeStop * mediaDuration) / 100)); + timeRanges->add(static_cast<float>((rangeStart * mediaDuration) / gPercentMax), + static_cast<float>((rangeStop * mediaDuration) / gPercentMax)); } // Fallback to the more general maxTimeLoaded() if no range has |