mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 05:56:31 +00:00
gst/gstbin.c: Be a bit more conservative about the posted message.
Original commit message from CVS: * gst/gstbin.c: (bin_bus_handler): Be a bit more conservative about the posted message. * gst/gstbus.c: (gst_bus_post): Some cleanups, warn wrong return values.
This commit is contained in:
parent
864b976fef
commit
46bb10ac37
3 changed files with 44 additions and 22 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-08-25 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/gstbin.c: (bin_bus_handler):
|
||||
Be a bit more conservative about the posted message.
|
||||
|
||||
* gst/gstbus.c: (gst_bus_post):
|
||||
Some cleanups, warn wrong return values.
|
||||
|
||||
2005-08-25 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* check/gst/gstbin.c: (GST_START_TEST):
|
||||
|
|
31
gst/gstbin.c
31
gst/gstbin.c
|
@ -1555,21 +1555,28 @@ bin_bus_handler (GstBus * bus, GstMessage * message, GstBin * bin)
|
|||
|
||||
switch (GST_MESSAGE_TYPE (message)) {
|
||||
case GST_MESSAGE_EOS:{
|
||||
gchar *name = gst_object_get_name (GST_MESSAGE_SRC (message));
|
||||
GstObject *src = GST_MESSAGE_SRC (message);
|
||||
|
||||
GST_DEBUG_OBJECT (bin, "got EOS message from %s", name);
|
||||
g_free (name);
|
||||
if (src) {
|
||||
gchar *name;
|
||||
|
||||
/* collect all eos messages from the children */
|
||||
GST_LOCK (bin->child_bus);
|
||||
bin->eosed = g_list_prepend (bin->eosed, GST_MESSAGE_SRC (message));
|
||||
GST_UNLOCK (bin->child_bus);
|
||||
name = gst_object_get_name (src);
|
||||
GST_DEBUG_OBJECT (bin, "got EOS message from %s", name);
|
||||
g_free (name);
|
||||
|
||||
/* if we are completely EOS, we forward an EOS message */
|
||||
if (is_eos (bin)) {
|
||||
GST_DEBUG_OBJECT (bin, "all sinks posted EOS");
|
||||
gst_element_post_message (GST_ELEMENT (bin),
|
||||
gst_message_new_eos (GST_OBJECT (bin)));
|
||||
/* collect all eos messages from the children */
|
||||
GST_LOCK (bin->child_bus);
|
||||
bin->eosed = g_list_prepend (bin->eosed, src);
|
||||
GST_UNLOCK (bin->child_bus);
|
||||
|
||||
/* if we are completely EOS, we forward an EOS message */
|
||||
if (is_eos (bin)) {
|
||||
GST_DEBUG_OBJECT (bin, "all sinks posted EOS");
|
||||
gst_element_post_message (GST_ELEMENT (bin),
|
||||
gst_message_new_eos (GST_OBJECT (bin)));
|
||||
}
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (bin, "got EOS message from (NULL), not processing");
|
||||
}
|
||||
|
||||
/* we drop all EOS messages */
|
||||
|
|
27
gst/gstbus.c
27
gst/gstbus.c
|
@ -197,22 +197,17 @@ gst_bus_post (GstBus * bus, GstMessage * message)
|
|||
message, GST_MESSAGE_TYPE (message));
|
||||
|
||||
GST_LOCK (bus);
|
||||
if (GST_FLAG_IS_SET (bus, GST_BUS_FLUSHING)) {
|
||||
GST_DEBUG_OBJECT (bus, "bus is flushing");
|
||||
gst_message_unref (message);
|
||||
GST_UNLOCK (bus);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if the bus is flushing */
|
||||
if (GST_FLAG_IS_SET (bus, GST_BUS_FLUSHING))
|
||||
goto is_flushing;
|
||||
|
||||
handler = bus->sync_handler;
|
||||
handler_data = bus->sync_handler_data;
|
||||
|
||||
GST_UNLOCK (bus);
|
||||
|
||||
/* first call the sync handler if it is installed */
|
||||
if (handler) {
|
||||
if (handler)
|
||||
reply = handler (bus, message, handler_data);
|
||||
}
|
||||
|
||||
/* now see what we should do with the message */
|
||||
switch (reply) {
|
||||
|
@ -265,9 +260,21 @@ gst_bus_post (GstBus * bus, GstMessage * message)
|
|||
g_cond_free (cond);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
g_warning ("invalid return from bus sync handler");
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
/* ERRORS */
|
||||
is_flushing:
|
||||
{
|
||||
GST_DEBUG_OBJECT (bus, "bus is flushing");
|
||||
gst_message_unref (message);
|
||||
GST_UNLOCK (bus);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue