gst/gstparse.c: Do not hange on recursive uasge of gst_parse_launch()
authorStefan Kost <ensonic@users.sourceforge.net>
Thu, 20 Jul 2006 20:02:55 +0000 (20:02 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Thu, 20 Jul 2006 20:02:55 +0000 (20:02 +0000)
Original commit message from CVS:
* gst/gstparse.c: (gst_parse_launch):
Do not hange on recursive uasge of gst_parse_launch()

ChangeLog
gst/gstparse.c

index bf92919..60bc8d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-20  Stefan Kost  <ensonic@users.sf.net>
+
+       * gst/gstparse.c: (gst_parse_launch):
+          Do not hange on recursive uasge of gst_parse_launch()
+
 2006-07-20  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/gsttaglist.c:
index 0098c6b..7847952 100644 (file)
@@ -136,7 +136,7 @@ gst_parse_launchv (const gchar ** argv, GError ** error)
 GstElement *
 gst_parse_launch (const gchar * pipeline_description, GError ** error)
 {
-  GstElement *element;
+  GstElement *element = NULL;
   static GStaticMutex flex_lock = G_STATIC_MUTEX_INIT;
 
   g_return_val_if_fail (pipeline_description != NULL, NULL);
@@ -145,9 +145,12 @@ gst_parse_launch (const gchar * pipeline_description, GError ** error)
       pipeline_description);
 
   /* the need for the mutex will go away with flex 2.5.6 */
-  g_static_mutex_lock (&flex_lock);
-  element = _gst_parse_launch (pipeline_description, error);
-  g_static_mutex_unlock (&flex_lock);
+  if (g_static_mutex_trylock (&flex_lock)) {
+    element = _gst_parse_launch (pipeline_description, error);
+    g_static_mutex_unlock (&flex_lock);
+  } else {
+    GST_WARNING ("gst_parse_launch() cannot be nested");
+  }
 
   return element;
 }