2006-05-30 Wim Taymans <wim@fluendo.com>
+ * libs/gst/base/gstcollectpads.c: (gst_collect_pads_remove_pad),
+ (gst_collect_pads_chain):
+ Handle the case where a pad is removed from the collection
+ that could cause the other pads to become collectable.
+
+2006-05-30 Wim Taymans <wim@fluendo.com>
+
* gst/gstelement.c:
Clarify the use of _release_request_pad() and
_get_request_pad() a bit better.
* @size: the size of the returned GstCollectData structure
*
* Add a pad to the collection of collect pads. The pad has to be
- * a sinkpad.
+ * a sinkpad. The refcount of the pad is incremented. Use
+ * gst_collect_pads_remove_pad() to remove the pad from the collection
+ * again.
*
* You specify a size for the returned #GstCollectData structure
* so that you can use it to store additional information.
pads->abidata.ABI.pad_list =
g_slist_delete_link (pads->abidata.ABI.pad_list, list);
pads->abidata.ABI.pad_cookie++;
+ /* signal waiters because something changed */
+ GST_COLLECT_PADS_BROADCAST (pads);
GST_COLLECT_PADS_PAD_UNLOCK (pads);
return TRUE;
gst_segment_set_last_stop (&data->segment, GST_FORMAT_TIME, timestamp);
}
- /* Check if our collected condition is matched and call the collected function
- * if it is */
- ret = gst_collect_pads_check_collected (pads);
- /* when an error occurs, we want to report this back to the caller ASAP
- * without having to block if the buffer was not popped */
- if (G_UNLIKELY (ret != GST_FLOW_OK))
- goto error;
+ /* While we have data queued on this pad try to collect stuff */
+ do {
+ /* Check if our collected condition is matched and call the collected function
+ * if it is */
+ ret = gst_collect_pads_check_collected (pads);
+ /* when an error occurs, we want to report this back to the caller ASAP
+ * without having to block if the buffer was not popped */
+ if (G_UNLIKELY (ret != GST_FLOW_OK))
+ goto error;
+
+ /* data was consumed, we can exit and accept new data */
+ if (data->buffer == NULL)
+ break;
- /* We still have data queued on this pad, wait for something to happen */
- while (data->buffer != NULL) {
GST_DEBUG ("Pad %s:%s has a buffer queued, waiting",
GST_DEBUG_PAD_NAME (pad));
if (G_UNLIKELY (data->abidata.ABI.flushing))
goto flushing;
}
+ while (data->buffer != NULL);
+
GST_OBJECT_UNLOCK (pads);
return ret;