elements: Handle GstIterator RESYNC return value correctly in gst_iterator_foreach()
authorSebastian Dröge <sebastian@centricular.com>
Mon, 5 Dec 2016 09:01:45 +0000 (11:01 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 5 Dec 2016 09:01:45 +0000 (11:01 +0200)
plugins/elements/gstconcat.c
plugins/elements/gsttee.c

index 865b41c..788cc9c 100644 (file)
@@ -800,10 +800,10 @@ gst_concat_change_state (GstElement * element, GstStateChange transition)
       self->current_start_offset = 0;
       self->last_stop = GST_CLOCK_TIME_NONE;
 
-      do {
-        res = gst_iterator_foreach (iter, reset_pad, NULL);
-      } while (res == GST_ITERATOR_RESYNC);
-
+      while ((res =
+              gst_iterator_foreach (iter, reset_pad,
+                  NULL)) == GST_ITERATOR_RESYNC)
+        gst_iterator_resync (iter);
       gst_iterator_free (iter);
 
       if (res == GST_ITERATOR_ERROR)
@@ -815,10 +815,10 @@ gst_concat_change_state (GstElement * element, GstStateChange transition)
       GstIteratorResult res;
 
       g_mutex_lock (&self->lock);
-      do {
-        res = gst_iterator_foreach (iter, unblock_pad, NULL);
-      } while (res == GST_ITERATOR_RESYNC);
-
+      while ((res =
+              gst_iterator_foreach (iter, unblock_pad,
+                  NULL)) == GST_ITERATOR_RESYNC)
+        gst_iterator_resync (iter);
       gst_iterator_free (iter);
       g_cond_broadcast (&self->cond);
       g_mutex_unlock (&self->lock);
index 906775d..2369814 100644 (file)
@@ -971,8 +971,10 @@ gst_tee_pull_eos (GstTee * tee)
   GstIterator *iter;
 
   iter = gst_element_iterate_src_pads (GST_ELEMENT (tee));
-  gst_iterator_foreach (iter, (GstIteratorForeachFunction) gst_tee_push_eos,
-      tee);
+  while (gst_iterator_foreach (iter,
+          (GstIteratorForeachFunction) gst_tee_push_eos,
+          tee) == GST_ITERATOR_RESYNC)
+    gst_iterator_resync (iter);
   gst_iterator_free (iter);
 }