Skip to content
Permalink
Browse files
[GStreamer] Buffering ranges are reported incorrectly with GStreamer 1.0
https://bugs.webkit.org/show_bug.cgi?id=105319

Patch by Xabier Rodriguez Calvar <calvaris@igalia.com> on 2012-12-21
Reviewed by Philippe Normand.

We add the gPercentMax constant to select between 100 and
GST_FORMAT_PERCENT_MAX depending if we are compiling against
GStreamer 0.10 or 1.0 and we use that in the corresponding method.

Current tests should suffice.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::buffered): Added the use of
gPercentMax constant instead of 100 to have the different code
paths for GStreamer 0.10 and 1.0.

Canonical link: https://commits.webkit.org/123849@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
calvaris authored and webkit-commit-queue committed Dec 21, 2012
1 parent 0b40f4a commit 6e52420e343dfb029c03b61e4c355cb95898b43e
Showing 2 changed files with 28 additions and 3 deletions.
@@ -1,3 +1,21 @@
2012-12-21 Xabier Rodriguez Calvar <calvaris@igalia.com>

[GStreamer] Buffering ranges are reported incorrectly with GStreamer 1.0
https://bugs.webkit.org/show_bug.cgi?id=105319

Reviewed by Philippe Normand.

We add the gPercentMax constant to select between 100 and
GST_FORMAT_PERCENT_MAX depending if we are compiling against
GStreamer 0.10 or 1.0 and we use that in the corresponding method.

Current tests should suffice.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::buffered): Added the use of
gPercentMax constant instead of 100 to have the different code
paths for GStreamer 0.10 and 1.0.

2012-12-21 Tim Horton <timothy_horton@apple.com>

PDFPlugin: Cannot drop files/URLs on PDFPlugin
@@ -75,10 +75,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);
@@ -758,11 +765,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

0 comments on commit 6e52420

Please sign in to comment.