[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

philn at webkit.org philn at webkit.org
Thu Apr 8 02:22:46 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit e9bbf3de0512c736db64c832d7c013bbb93015ee
Author: philn at webkit.org <philn at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Mar 15 20:18:47 2010 +0000

    2010-03-15  Philippe Normand  <pnormand at igalia.com>
    
            Reviewed by Gustavo Noronha Silva.
    
            [GStreamer] duration query optimizations
            https://bugs.webkit.org/show_bug.cgi?id=36116
    
            Don't reattempt duration queries that previously failed and cache
            media duration only if it's known.
    
            * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
            (WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
            (WebCore::MediaPlayerPrivate::duration):
            (WebCore::MediaPlayerPrivate::updateStates):
            (WebCore::MediaPlayerPrivate::durationChanged):
            * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56010 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 37ebcd9..d180629 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-03-15  Philippe Normand  <pnormand at igalia.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        [GStreamer] duration query optimizations
+        https://bugs.webkit.org/show_bug.cgi?id=36116
+
+        Don't reattempt duration queries that previously failed and cache
+        media duration only if it's known.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
+        (WebCore::MediaPlayerPrivate::duration):
+        (WebCore::MediaPlayerPrivate::updateStates):
+        (WebCore::MediaPlayerPrivate::durationChanged):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+
 2010-03-11  Peter Kasting  <pkasting at google.com>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index ea268ed..93986da 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -298,6 +298,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
     , m_bufferingPercentage(0)
     , m_preload(MediaPlayer::Auto)
     , m_delayingLoad(false)
+    , m_mediaDurationKnown(true)
 {
     if (doGstInit())
         createGSTPlayBin();
@@ -417,6 +418,10 @@ float MediaPlayerPrivate::duration() const
     if (m_errorOccured)
         return 0.0;
 
+    // Media duration query failed already, don't attempt new useless queries.
+    if (!m_mediaDurationKnown)
+        return numeric_limits<float>::infinity();
+
     if (m_mediaDuration)
         return m_mediaDuration;
 
@@ -875,7 +880,8 @@ void MediaPlayerPrivate::updateStates()
 
             if (!m_mediaDuration) {
                 float newDuration = duration();
-                if (!isinf(newDuration))
+                m_mediaDurationKnown = !isinf(newDuration);
+                if (m_mediaDurationKnown)
                     m_mediaDuration = newDuration;
             }
 
@@ -1113,7 +1119,22 @@ void MediaPlayerPrivate::durationChanged()
     m_mediaDuration = 0;
 
     // And re-cache it if possible.
+    GstState state;
+    gst_element_get_state(m_playBin, &state, 0, 0);
     float newDuration = duration();
+
+    if (state <= GST_STATE_READY) {
+        // Don't set m_mediaDurationKnown yet if the pipeline is not
+        // paused. This allows duration() query to fail at least once
+        // before playback starts and duration becomes known.
+        if (!isinf(newDuration))
+            m_mediaDuration = newDuration;
+    } else {
+        m_mediaDurationKnown = !isinf(newDuration);
+        if (m_mediaDurationKnown)
+            m_mediaDuration = newDuration;
+    }
+
     if (!isinf(newDuration))
         m_mediaDuration = newDuration;
 
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
index 4389b28..ec9123a 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
@@ -170,6 +170,7 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
             int m_bufferingPercentage;
             MediaPlayer::Preload m_preload;
             bool m_delayingLoad;
+            bool m_mediaDurationKnown;
     };
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list