bus: Check if pending messages are in the queue

We can't rely completely on the poll fd because the fd might be
created after messages were posted to the bus.
This commit is contained in:
Sebastian Dröge 2011-04-06 12:03:18 +02:00
parent ec0de993c6
commit bd1c400114

View file

@ -694,8 +694,10 @@ typedef struct
static gboolean
gst_bus_source_prepare (GSource * source, gint * timeout)
{
GstBusSource *bsrc = (GstBusSource *) source;
*timeout = -1;
return FALSE;
return gst_bus_have_pending (bsrc->bus);
}
static gboolean
@ -703,7 +705,8 @@ gst_bus_source_check (GSource * source)
{
GstBusSource *bsrc = (GstBusSource *) source;
return bsrc->bus->priv->pollfd.revents & (G_IO_IN | G_IO_HUP | G_IO_ERR);
return gst_bus_have_pending (bsrc->bus) | (bsrc->bus->priv->
pollfd.revents & (G_IO_IN | G_IO_HUP | G_IO_ERR));
}
static gboolean