bus: Immediately drop messages after calling the sync handler if this is a synchronous bus

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
This commit is contained in:
Sebastian Dröge 2011-04-07 11:24:35 +02:00
parent c41b0ade28
commit 80eb160e0f

View file

@ -347,6 +347,11 @@ gst_bus_post (GstBus * bus, GstMessage * message)
&& handler != gst_bus_sync_signal_handler) && handler != gst_bus_sync_signal_handler)
gst_bus_sync_signal_handler (bus, message, NULL); 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 */ /* now see what we should do with the message */
switch (reply) { switch (reply) {
case GST_BUS_DROP: case GST_BUS_DROP:
@ -357,7 +362,6 @@ gst_bus_post (GstBus * bus, GstMessage * message)
/* pass the message to the async queue, refcount passed in the queue */ /* pass the message to the async queue, refcount passed in the queue */
GST_DEBUG_OBJECT (bus, "[msg %p] pushing on async queue", message); GST_DEBUG_OBJECT (bus, "[msg %p] pushing on async queue", message);
gst_atomic_queue_push (bus->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); GST_DEBUG_OBJECT (bus, "[msg %p] pushed on async queue", message);
@ -380,7 +384,6 @@ gst_bus_post (GstBus * bus, GstMessage * message)
g_mutex_lock (lock); g_mutex_lock (lock);
gst_atomic_queue_push (bus->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);
/* now block till the message is freed */ /* now block till the message is freed */