2009-11-12 Philippe Normand <pnormand@igalia.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Nov 2009 10:39:57 +0000 (10:39 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Nov 2009 10:39:57 +0000 (10:39 +0000)
        Reviewed by Jan Alonzo.

        https://bugs.webkit.org/show_bug.cgi?id=31047
        [GTK] Failing test media/video-played-ranges-1.html

        Follow-up of r50726, don't block the UI thread when calling
        gst_element_get_state(). Also fixed a compilation warning and some
        static casts.

        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::playbackPosition):
        (WebCore::MediaPlayerPrivate::seek):
        (WebCore::MediaPlayerPrivate::setRate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@50873 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp

index 4c20f5ac19733902dcd8d7f4d5bfe353894dfd31..3544486dfd113a23b3475c20cbad0f71deb5a092 100644 (file)
@@ -1,3 +1,19 @@
+2009-11-12  Philippe Normand  <pnormand@igalia.com>
+
+        Reviewed by Jan Alonzo.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31047
+        [GTK] Failing test media/video-played-ranges-1.html
+
+        Follow-up of r50726, don't block the UI thread when calling
+        gst_element_get_state(). Also fixed a compilation warning and some
+        static casts.
+
+        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::playbackPosition):
+        (WebCore::MediaPlayerPrivate::seek):
+        (WebCore::MediaPlayerPrivate::setRate):
+
 2009-11-12  Philippe Normand  <pnormand@igalia.com>
 
         Reviewed by Jan Alonzo.
index 091506d30c3e59f58f622344d67bb29fdb720944..4f85f79145ec77751934295315ef259a664995e8 100644 (file)
@@ -116,8 +116,8 @@ static float playbackPosition(GstElement* playbin)
 
     // Position is available only if the pipeline is not in NULL or
     // READY state.
-    if (position != GST_CLOCK_TIME_NONE)
-        ret = (float) (position / 1000000000.0);
+    if (position !=  static_cast<gint64>(GST_CLOCK_TIME_NONE))
+        ret = static_cast<float>(position) / static_cast<float>(GST_SECOND);
 
     LOG_VERBOSE(Media, "Position %" GST_TIME_FORMAT, GST_TIME_ARGS(position));
 
@@ -391,9 +391,9 @@ void MediaPlayerPrivate::setRate(float rate)
     GstState state;
     GstState pending;
 
-    gst_element_get_state(m_playBin,
-        &state, &pending, 250 * GST_NSECOND);
-    if (state != GST_STATE_PLAYING && state != GST_STATE_PAUSED)
+    gst_element_get_state(m_playBin, &state, &pending, 0);
+    if ((state != GST_STATE_PLAYING && state != GST_STATE_PAUSED)
+        || (pending == GST_STATE_PAUSED))
         return;
 
     if (m_isStreaming)
@@ -418,7 +418,7 @@ void MediaPlayerPrivate::setRate(float rate)
 
         // If we are at beginning of media, start from the end to
         // avoid immediate EOS.
-        if (currentPosition == 0 || currentPosition == -1)
+        if (currentPosition <= 0)
             end = duration() * GST_SECOND;
         else
             end = currentPosition;
@@ -430,11 +430,8 @@ void MediaPlayerPrivate::setRate(float rate)
                           GST_SEEK_TYPE_SET, start,
                           GST_SEEK_TYPE_SET, end))
         LOG_VERBOSE(Media, "Set rate to %f failed", rate);
-    else {
+    else
         g_object_set(m_playBin, "mute", mute, NULL);
-        // Wait some time for the seek to complete.
-        gst_element_get_state(m_playBin, 0, 0, 40 * GST_MSECOND);
-    }
 }
 
 int MediaPlayerPrivate::dataRate() const