]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
bus: Immediately drop messages after calling the sync handler if this is a synchronou...
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 7 Apr 2011 09:24:35 +0000 (11:24 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 8 Apr 2011 07:15:56 +0000 (09:15 +0200)
Otherwise we might wait forever for the message to be popped from
the queue if a sync handler returned GST_BUS_ASYNC.

https://bugzilla.gnome.org/show_bug.cgi?id=647005

gst/gstbus.c

index c102fb95857281c0e97136d2c5a364c91e480735..4135a1586614d52ef8500ea225ecd5675f01b08d 100644 (file)
@@ -347,6 +347,11 @@ gst_bus_post (GstBus * bus, GstMessage * message)
       && handler != gst_bus_sync_signal_handler)
     gst_bus_sync_signal_handler (bus, message, NULL);
 
+  /* If this is a bus without async message delivery
+   * always drop the message */
+  if (!bus->priv->poll)
+    reply = GST_BUS_DROP;
+
   /* now see what we should do with the message */
   switch (reply) {
     case GST_BUS_DROP:
@@ -357,8 +362,7 @@ gst_bus_post (GstBus * bus, GstMessage * message)
       /* pass the message to the async queue, refcount passed in the queue */
       GST_DEBUG_OBJECT (bus, "[msg %p] pushing on async queue", message);
       gst_atomic_queue_push (bus->queue, message);
-      if (bus->priv->poll)
-        gst_poll_write_control (bus->priv->poll);
+      gst_poll_write_control (bus->priv->poll);
       GST_DEBUG_OBJECT (bus, "[msg %p] pushed on async queue", message);
 
       break;
@@ -380,8 +384,7 @@ gst_bus_post (GstBus * bus, GstMessage * message)
       g_mutex_lock (lock);
 
       gst_atomic_queue_push (bus->queue, message);
-      if (bus->priv->poll)
-        gst_poll_write_control (bus->priv->poll);
+      gst_poll_write_control (bus->priv->poll);
 
       /* now block till the message is freed */
       g_cond_wait (cond, lock);