2009-11-25 Philippe Normand <pnormand@igalia.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Nov 2009 15:59:05 +0000 (15:59 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Nov 2009 15:59:05 +0000 (15:59 +0000)
        Reviewed by Eric Seidel.

        [GTK] use gst_init_check() instead of gst_init()
        https://bugs.webkit.org/show_bug.cgi?id=31864

        Use gst_init_check() instead of gst_init() to prevent eventual
        unexpected exit of the application.

        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::do_gst_init):
        (WebCore::MediaPlayerPrivate::isAvailable):

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

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

index 96120c59eef5174656bba8400ef9f66d2b805f0f..342466b8ef8bfb8a786e299c16448a3ecfe5c7b4 100644 (file)
@@ -1,3 +1,17 @@
+2009-11-25  Philippe Normand  <pnormand@igalia.com>
+
+        Reviewed by Eric Seidel.
+
+        [GTK] use gst_init_check() instead of gst_init()
+        https://bugs.webkit.org/show_bug.cgi?id=31864
+
+        Use gst_init_check() instead of gst_init() to prevent eventual
+        unexpected exit of the application.
+
+        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::do_gst_init):
+        (WebCore::MediaPlayerPrivate::isAvailable):
+
 2009-11-25  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
 
         Reviewed by Xan Lopez.
index b325d8cbba40a206795ed5c0c5dba7dedea6baa4..c0242a14ee2abf1f651aee775430e35256d71ef2 100644 (file)
@@ -146,21 +146,28 @@ void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar)
 
 static bool gstInitialized = false;
 
-static void do_gst_init()
+static bool do_gst_init()
 {
     // FIXME: We should pass the arguments from the command line
     if (!gstInitialized) {
-        gst_init(0, 0);
-        gstInitialized = true;
-        gst_element_register(0, "webkitmediasrc", GST_RANK_PRIMARY,
-                             WEBKIT_TYPE_DATA_SRC);
+        GOwnPtr<GError> error;
+        gstInitialized = gst_init_check(0, 0, &error.outPtr());
+        if (!gstInitialized)
+            LOG_VERBOSE(Media, "Could not initialize GStreamer: %s",
+                        error ? error->message : "unknown error occurred");
+        else
+            gst_element_register(0, "webkitmediasrc", GST_RANK_PRIMARY,
+                                 WEBKIT_TYPE_DATA_SRC);
 
     }
+    return gstInitialized;
 }
 
 bool MediaPlayerPrivate::isAvailable()
 {
-    do_gst_init();
+    if (!do_gst_init())
+        return false;
+
     GstElementFactory* factory = gst_element_factory_find("playbin2");
     if (factory) {
         gst_object_unref(GST_OBJECT(factory));