[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

hausmann at webkit.org hausmann at webkit.org
Fri Jan 21 14:57:31 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit f8b5ffe804974929f69e09f564a72f6843048ea3
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 5 15:48:50 2011 +0000

    [GStreamer] MediaPlayerPrivateGStreamer::totalBytes() does not work reliably
    https://bugs.webkit.org/show_bug.cgi?id=51926
    
    Reviewed by Kenneth Rohde Christiansen, Gustavo Noronha Silva
    
    Work around potential upstream bug: Querying a GstBin for the duration,
    will forward the query to all sink children. Our WebKitWebSrc however
    is a bin with only source children, therefore the query fails. Until
    this is changed upstream, this patch works around it as follows,
    based on suggestion by Philippe Normand and Sebastian Dröge:
    
    When the initial query fails, attempt the same query on all source
    pads and take the maximum length reported.
    
    * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
    (WebCore::MediaPlayerPrivateGStreamer::totalBytes):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75065 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 73a7e71..e149f69 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2011-01-05  Simon Hausmann  <simon.hausmann at nokia.com>
+
+        Reviewed by Kenneth Rohde Christiansen, Gustavo Noronha Silva
+
+        [GStreamer] MediaPlayerPrivateGStreamer::totalBytes() does not work reliably
+        https://bugs.webkit.org/show_bug.cgi?id=51926
+
+        Work around potential upstream bug: Querying a GstBin for the duration,
+        will forward the query to all sink children. Our WebKitWebSrc however
+        is a bin with only source children, therefore the query fails. Until
+        this is changed upstream, this patch works around it as follows,
+        based on suggestion by Philippe Normand and Sebastian Dröge:
+
+        When the initial query fails, attempt the same query on all source
+        pads and take the maximum length reported.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::totalBytes):
+
 2011-01-05  Philippe Normand  <pnormand at igalia.com>
 
         Rubber-stamped by Eric Seidel.
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index 1cf6cd7..c113c69 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -889,7 +889,40 @@ unsigned MediaPlayerPrivateGStreamer::totalBytes() const
 
     GstFormat fmt = GST_FORMAT_BYTES;
     gint64 length = 0;
-    gst_element_query_duration(m_source, &fmt, &length);
+    if (gst_element_query_duration(m_source, &fmt, &length)) {
+        LOG_VERBOSE(Media, "totalBytes %" G_GINT64_FORMAT, length);
+        return static_cast<unsigned>(length);
+    }
+
+    // Fall back to querying the source pads manually.
+    // See also https://bugzilla.gnome.org/show_bug.cgi?id=638749
+    GstIterator* iter = gst_element_iterate_src_pads(m_source);
+    bool done = false;
+    while (!done) {
+        gpointer data;
+
+        switch (gst_iterator_next(iter, &data)) {
+        case GST_ITERATOR_OK: {
+            GstPad* pad = GST_PAD_CAST(data);
+            gint64 padLength = 0;
+            if (gst_pad_query_duration(pad, &fmt, &padLength)
+                && padLength > length)
+                length = padLength;
+            gst_object_unref(pad);
+            break;
+        }
+        case GST_ITERATOR_RESYNC:
+            gst_iterator_resync(iter);
+            break;
+        case GST_ITERATOR_ERROR:
+            // Fall through.
+        case GST_ITERATOR_DONE:
+            done = true;
+            break;
+        }
+    }
+    gst_iterator_free(iter);
+
     LOG_VERBOSE(Media, "totalBytes %" G_GINT64_FORMAT, length);
 
     return static_cast<unsigned>(length);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list