gst/gstpad.c: The default event function on a sinkpad should return TRUE when there are no internal links but should ...
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_event_default_dispatch):
The default event function on a sinkpad should return TRUE when
there are no internal links but should collect the return values from
the internal links otherwise.
diff --git a/ChangeLog b/ChangeLog
index 167f569..bfe0376 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-05-27 Wim Taymans <wim.taymans@collabora.co.uk>
+ * gst/gstpad.c: (gst_pad_event_default_dispatch):
+ The default event function on a sinkpad should return TRUE when
+ there are no internal links but should collect the return values from
+ the internal links otherwise.
+
+2008-05-27 Wim Taymans <wim.taymans@collabora.co.uk>
+
* plugins/elements/gsttypefindelement.c:
(gst_type_find_element_src_event),
(gst_type_find_element_handle_event):
diff --git a/gst/gstpad.c b/gst/gstpad.c
index 01ad4c6..ed1a1b6 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -2972,10 +2972,19 @@
GST_INFO_OBJECT (pad, "Sending event %p (%s) to all internally linked pads",
event, GST_EVENT_TYPE_NAME (event));
- result = (GST_PAD_DIRECTION (pad) == GST_PAD_SINK);
-
orig = pads = gst_pad_get_internal_links (pad);
+ if (!pads) {
+ /* If this is a sinkpad and we don't have pads to send the event to, we
+ * return TRUE. This is so that when using the default handler on a sink
+ * element, we don't fail to push it. */
+ result = (GST_PAD_DIRECTION (pad) == GST_PAD_SINK);
+ } else {
+ /* we have pads, the result will be TRUE if one of the pads handled the
+ * event in the code below. */
+ result = FALSE;
+ }
+
while (pads) {
GstPad *eventpad = GST_PAD_CAST (pads->data);
@@ -2987,7 +2996,7 @@
GST_LOG_OBJECT (pad, "Reffing and sending event %p (%s) to %s:%s",
event, GST_EVENT_TYPE_NAME (event), GST_DEBUG_PAD_NAME (eventpad));
gst_event_ref (event);
- gst_pad_push_event (eventpad, event);
+ result |= gst_pad_push_event (eventpad, event);
} else {
/* we only send the event on one pad, multi-sinkpad elements
* should implement a handler */