From c138aa8648567f95331a8497dc82cb5e567dc017 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 28 Jul 2009 21:14:11 +0200 Subject: [PATCH] collectpads: Make sure the CollectData list is up-to-date when reading/setting it Without this, we risked: * Checking the flushing state on an unexisting list * Not setting the flushing state on pads that had just been added Partially fixes #590056 --- libs/gst/base/gstcollectpads.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c index 0d38d835c2..e92df62ef4 100644 --- a/libs/gst/base/gstcollectpads.c +++ b/libs/gst/base/gstcollectpads.c @@ -510,16 +510,25 @@ gst_collect_pads_collect_range (GstCollectPads * pads, guint64 offset, static gboolean gst_collect_pads_is_flushing (GstCollectPads * pads) { - GSList *walk = pads->data; + GSList *walk = NULL; gboolean res = TRUE; GST_COLLECT_PADS_PAD_LOCK (pads); - while (walk) { + + /* Ensure pads->data state */ + gst_collect_pads_check_pads_unlocked (pads); + + GST_DEBUG ("Getting flushing state (pads:%p, pads->data:%p)", + pads, pads->data); + + for (walk = pads->data; walk; walk = g_slist_next (walk)) { GstCollectData *cdata = walk->data; - if (cdata->abidata.ABI.flushing) + GST_DEBUG_OBJECT (cdata->pad, "flushing:%d", cdata->abidata.ABI.flushing); + + if (cdata->abidata.ABI.flushing) { goto done; - walk = g_slist_next (walk); + } } res = FALSE; @@ -582,6 +591,8 @@ gst_collect_pads_set_flushing (GstCollectPads * pads, gboolean flushing) g_return_if_fail (GST_IS_COLLECT_PADS (pads)); GST_COLLECT_PADS_PAD_LOCK (pads); + /* Ensure pads->data state */ + gst_collect_pads_check_pads_unlocked (pads); gst_collect_pads_set_flushing_unlocked (pads, flushing); GST_COLLECT_PADS_PAD_UNLOCK (pads); }