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
This commit is contained in:
Mark Nauwelaerts 2011-04-20 15:39:16 +02:00 committed by Tim-Philipp Müller
parent 547d451772
commit 03391a8970

View file

@ -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);