libs/gst/base/gstcollectpads.c: Flush queued buffer on _stop(), fixes playing again (#342454)

Original commit message from CVS:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_stop),
(gst_collect_pads_check_collected):
Flush queued buffer on _stop(), fixes playing again (#342454)
This commit is contained in:
Stefan Kost 2006-05-22 16:30:34 +00:00
parent 9e1111cb03
commit a039f14524
2 changed files with 28 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2006-05-22 Stefan Kost <ensonic@users.sf.net>
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_stop),
(gst_collect_pads_check_collected):
Flush queued buffer on _stop(), fixes playing again (#342454)
2006-05-22 Thomas Vander Stichele <thomas at apestaart dot org>
* tests/check/gst/gststructure.c: (GST_START_TEST),

View file

@ -455,6 +455,8 @@ gst_collect_pads_start (GstCollectPads * pads)
void
gst_collect_pads_stop (GstCollectPads * pads)
{
GSList *collected;
g_return_if_fail (pads != NULL);
g_return_if_fail (GST_IS_COLLECT_PADS (pads));
@ -469,6 +471,23 @@ gst_collect_pads_stop (GstCollectPads * pads)
/* Stop collect pads */
pads->started = FALSE;
/* loop over the master pad list and flush buffers */
collected = pads->abidata.ABI.pad_list;
for (; collected; collected = g_slist_next (collected)) {
GstCollectData *data;
GstBuffer **buffer_p;
data = collected->data;
if (data->buffer) {
buffer_p = &data->buffer;
gst_buffer_replace (buffer_p, NULL);
data->pos = 0;
/* one less pad with queued data now */
pads->queuedpads--;
}
}
GST_COLLECT_PADS_PAD_UNLOCK (pads);
/* Wake them up so then can end the chain functions. */
GST_COLLECT_PADS_BROADCAST (pads);
@ -779,8 +798,9 @@ gst_collect_pads_check_collected (GstCollectPads * pads)
* function
*/
while (((pads->queuedpads + pads->eospads) >= pads->numpads)) {
GST_DEBUG ("All active pads (%d) have data, calling %s",
pads->numpads, GST_DEBUG_FUNCPTR_NAME (pads->func));
GST_DEBUG ("All active pads (%d + %d >= %d) have data, calling %s",
pads->queuedpads, pads->eospads, pads->numpads,
GST_DEBUG_FUNCPTR_NAME (pads->func));
flow_ret = pads->func (pads, pads->user_data);
collected = TRUE;