[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:13:32 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 0634d74cb6e4117efc575e67223c5af2d22971e2
Author: philn at webkit.org <philn at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Mar 8 08:13:58 2010 +0000

    2010-03-04  Philippe Normand  <pnormand at igalia.com>
    
            Reviewed by Eric Seidel.
    
            [GStreamer] replace g_idle_add / g_timeout_add calls with Timers in the gstreamer player
            https://bugs.webkit.org/show_bug.cgi?id=35735
    
            Replaced g_idle_add calls with Timers immediately started once
            only. The g_timeout_add was replaced by a periodic Timer.
    
            * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
            (WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
            (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate):
            (WebCore::MediaPlayerPrivate::volumeChangedTimerFired):
            (WebCore::MediaPlayerPrivate::volumeChanged):
            (WebCore::MediaPlayerPrivate::processBufferingStats):
            (WebCore::MediaPlayerPrivate::fillTimerFired):
            (WebCore::MediaPlayerPrivate::maxTimeLoaded):
            (WebCore::MediaPlayerPrivate::updateStates):
            (WebCore::MediaPlayerPrivate::muteChangedTimerFired):
            (WebCore::MediaPlayerPrivate::muteChanged):
            * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55657 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f9338d2..92d76a9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-03-04  Philippe Normand  <pnormand at igalia.com>
+
+        Reviewed by Eric Seidel.
+
+        [GStreamer] replace g_idle_add / g_timeout_add calls with Timers in the gstreamer player
+        https://bugs.webkit.org/show_bug.cgi?id=35735
+
+        Replaced g_idle_add calls with Timers immediately started once
+        only. The g_timeout_add was replaced by a periodic Timer.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
+        (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate):
+        (WebCore::MediaPlayerPrivate::volumeChangedTimerFired):
+        (WebCore::MediaPlayerPrivate::volumeChanged):
+        (WebCore::MediaPlayerPrivate::processBufferingStats):
+        (WebCore::MediaPlayerPrivate::fillTimerFired):
+        (WebCore::MediaPlayerPrivate::maxTimeLoaded):
+        (WebCore::MediaPlayerPrivate::updateStates):
+        (WebCore::MediaPlayerPrivate::muteChangedTimerFired):
+        (WebCore::MediaPlayerPrivate::muteChanged):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+
 2010-03-07  David Levin  <levin at chromium.org>
 
         Chromium Linux build fix.
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index fe4b2f9..88140bd 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -177,13 +177,6 @@ void mediaPlayerPrivateVolumeChangedCallback(GObject *element, GParamSpec *pspec
     mp->volumeChanged();
 }
 
-gboolean notifyVolumeIdleCallback(gpointer data)
-{
-    MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
-    mp->volumeChangedCallback();
-    return FALSE;
-}
-
 void mediaPlayerPrivateMuteChangedCallback(GObject *element, GParamSpec *pspec, gpointer data)
 {
     // This is called when playbin receives the notify::mute signal.
@@ -191,19 +184,6 @@ void mediaPlayerPrivateMuteChangedCallback(GObject *element, GParamSpec *pspec,
     mp->muteChanged();
 }
 
-gboolean notifyMuteIdleCallback(gpointer data)
-{
-    MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
-    mp->muteChangedCallback();
-    return FALSE;
-}
-
-gboolean bufferingTimeoutCallback(gpointer data)
-{
-    MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
-    return mp->queryBufferingStats();
-}
-
 static float playbackPosition(GstElement* playbin)
 {
 
@@ -307,11 +287,9 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
     , m_seeking(false)
     , m_playbackRate(1)
     , m_errorOccured(false)
-    , m_volumeIdleId(0)
     , m_mediaDuration(0)
-    , m_muteIdleId(0)
     , m_startedBuffering(false)
-    , m_fillTimeoutId(0)
+    , m_fillTimer(this, &MediaPlayerPrivate::fillTimerFired)
     , m_maxTimeLoaded(0)
     , m_fillStatus(0)
 {
@@ -321,20 +299,8 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
 
 MediaPlayerPrivate::~MediaPlayerPrivate()
 {
-    if (m_fillTimeoutId) {
-        g_source_remove(m_fillTimeoutId);
-        m_fillTimeoutId = 0;
-    }
-
-    if (m_volumeIdleId) {
-        g_source_remove(m_volumeIdleId);
-        m_volumeIdleId = 0;
-    }
-
-    if (m_muteIdleId) {
-        g_source_remove(m_muteIdleId);
-        m_muteIdleId = 0;
-    }
+    if (m_fillTimer.isActive())
+        m_fillTimer.stop();
 
     if (m_buffer)
         gst_buffer_unref(m_buffer);
@@ -591,7 +557,7 @@ void MediaPlayerPrivate::setVolume(float volume)
     g_object_set(m_playBin, "volume", static_cast<double>(volume), NULL);
 }
 
-void MediaPlayerPrivate::volumeChangedCallback()
+void MediaPlayerPrivate::volumeChangedTimerFired(Timer<MediaPlayerPrivate>*)
 {
     double volume;
     g_object_get(m_playBin, "volume", &volume, NULL);
@@ -600,9 +566,8 @@ void MediaPlayerPrivate::volumeChangedCallback()
 
 void MediaPlayerPrivate::volumeChanged()
 {
-    if (m_volumeIdleId)
-        g_source_remove(m_volumeIdleId);
-    m_volumeIdleId = g_idle_add((GSourceFunc) notifyVolumeIdleCallback, this);
+    Timer<MediaPlayerPrivate> volumeChangedTimer(this, &MediaPlayerPrivate::volumeChangedTimerFired);
+    volumeChangedTimer.startOneShot(0);
 }
 
 void MediaPlayerPrivate::setRate(float rate)
@@ -688,20 +653,20 @@ void MediaPlayerPrivate::processBufferingStats(GstMessage* message)
     if (!m_startedBuffering) {
         m_startedBuffering = true;
 
-        if (m_fillTimeoutId > 0)
-            g_source_remove(m_fillTimeoutId);
+        if (m_fillTimer.isActive())
+            m_fillTimer.stop();
 
-        m_fillTimeoutId = g_timeout_add(200, (GSourceFunc) bufferingTimeoutCallback, this);
+        m_fillTimer.startRepeating(0.2);
     }
 }
 
-bool MediaPlayerPrivate::queryBufferingStats()
+void MediaPlayerPrivate::fillTimerFired(Timer<MediaPlayerPrivate>*)
 {
     GstQuery* query = gst_query_new_buffering(GST_FORMAT_PERCENT);
 
     if (!gst_element_query(m_playBin, query)) {
         gst_query_unref(query);
-        return TRUE;
+        return;
     }
 
     gint64 start, stop;
@@ -728,16 +693,15 @@ bool MediaPlayerPrivate::queryBufferingStats()
 
     if (m_fillStatus != 100.0) {
         updateStates();
-        return TRUE;
+        return;
     }
 
     // Media is now fully loaded. It will play even if network
     // connection is cut. Buffering is done, remove the fill source
     // from the main loop.
-    m_fillTimeoutId = 0;
+    m_fillTimer.stop();
     m_startedBuffering = false;
     updateStates();
-    return FALSE;
 }
 
 float MediaPlayerPrivate::maxTimeSeekable() const
@@ -759,7 +723,7 @@ float MediaPlayerPrivate::maxTimeLoaded() const
         return 0.0;
 
     float loaded = m_maxTimeLoaded;
-    if (!loaded && !m_fillTimeoutId)
+    if (!loaded && !m_fillTimer.isActive())
         loaded = duration();
     LOG_VERBOSE(Media, "maxTimeLoaded: %f", loaded);
     return loaded;
@@ -850,7 +814,7 @@ void MediaPlayerPrivate::updateStates()
             m_paused = true;
 
         // Is on-disk buffering in progress?
-        if (m_fillTimeoutId) {
+        if (m_fillTimer.isActive()) {
             m_networkState = MediaPlayer::Loading;
             // Buffering has just started, we should now have enough
             // data to restart playback if it was internally paused by
@@ -1114,7 +1078,7 @@ void MediaPlayerPrivate::setMuted(bool muted)
     g_object_set(m_playBin, "mute", muted, NULL);
 }
 
-void MediaPlayerPrivate::muteChangedCallback()
+void MediaPlayerPrivate::muteChangedTimerFired(Timer<MediaPlayerPrivate>*)
 {
     gboolean muted;
     g_object_get(m_playBin, "mute", &muted, NULL);
@@ -1123,10 +1087,8 @@ void MediaPlayerPrivate::muteChangedCallback()
 
 void MediaPlayerPrivate::muteChanged()
 {
-    if (m_muteIdleId)
-        g_source_remove(m_muteIdleId);
-
-    m_muteIdleId = g_idle_add((GSourceFunc) notifyMuteIdleCallback, this);
+    Timer<MediaPlayerPrivate> muteChangedTimer(this, &MediaPlayerPrivate::muteChangedTimerFired);
+    muteChangedTimer.startOneShot(0);
 }
 
 void MediaPlayerPrivate::loadingFailed(MediaPlayer::NetworkState error)
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
index 401dd65..39f6e4c 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
@@ -80,15 +80,15 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
 
             void setVolume(float);
             void volumeChanged();
-            void volumeChangedCallback();
+            void volumeChangedTimerFired(Timer<MediaPlayerPrivate>*);
 
             bool supportsMuting() const;
             void setMuted(bool);
             void muteChanged();
-            void muteChangedCallback();
+            void muteChangedTimerFired(Timer<MediaPlayerPrivate>*);
 
             void setPreload(MediaPlayer::Preload);
-            bool queryBufferingStats();
+            void fillTimerFired(Timer<MediaPlayerPrivate>*);
 
             MediaPlayer::NetworkState networkState() const;
             MediaPlayer::ReadyState readyState() const;
@@ -160,11 +160,9 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
             bool m_seeking;
             float m_playbackRate;
             bool m_errorOccured;
-            guint m_volumeIdleId;
             gfloat m_mediaDuration;
-            guint m_muteIdleId;
             bool m_startedBuffering;
-            guint m_fillTimeoutId;
+            Timer<MediaPlayerPrivate> m_fillTimer;
             float m_maxTimeLoaded;
             gdouble m_fillStatus;
     };

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list