From 03391a897001d35d1d290f27dd12e98a8b729fb4 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Wed, 20 Apr 2011 15:39:16 +0200 Subject: [PATCH] bus: also allow popping a message without timeout if no poll available ... which happens in particular flushing a bus, possibly as part of a state change, e.g. when having a pipeline in a pipeline and then changing state back to NULL. The interior pipeline will/might then flush the bus, which is a child bus from the parent which does not have a poll anymore these days. https://bugzilla.gnome.org/show_bug.cgi?id=648297 --- gst/gstbus.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gst/gstbus.c b/gst/gstbus.c index 2cc41af..caff420 100644 --- a/gst/gstbus.c +++ b/gst/gstbus.c @@ -499,7 +499,7 @@ gst_bus_timed_pop_filtered (GstBus * bus, GstClockTime timeout, g_return_val_if_fail (GST_IS_BUS (bus), NULL); g_return_val_if_fail (types != 0, NULL); - g_return_val_if_fail (bus->priv->poll != NULL, NULL); + g_return_val_if_fail (timeout == 0 || bus->priv->poll != NULL, NULL); g_mutex_lock (bus->queue_lock); @@ -510,7 +510,8 @@ gst_bus_timed_pop_filtered (GstBus * bus, GstClockTime timeout, gst_atomic_queue_length (bus->queue)); while ((message = gst_atomic_queue_pop (bus->queue))) { - gst_poll_read_control (bus->priv->poll); + if (bus->priv->poll) + gst_poll_read_control (bus->priv->poll); GST_DEBUG_OBJECT (bus, "got message %p, %s, type mask is %u", message, GST_MESSAGE_TYPE_NAME (message), (guint) types); if ((GST_MESSAGE_TYPE (message) & types) != 0) { @@ -544,6 +545,8 @@ gst_bus_timed_pop_filtered (GstBus * bus, GstClockTime timeout, } } + /* only here in timeout case */ + g_assert (bus->priv->poll); g_mutex_unlock (bus->queue_lock); ret = gst_poll_wait (bus->priv->poll, timeout); g_mutex_lock (bus->queue_lock); -- 2.7.4