composition: Avoid looping using gotos

This commit is contained in:
Thibault Saunier 2014-06-26 19:00:03 +02:00
parent 03b11d58e4
commit 924f9ecf83

View file

@ -1831,26 +1831,21 @@ gnl_composition_change_state (GstElement * element, GstStateChange transition)
children = gst_bin_iterate_elements (GST_BIN (comp)); children = gst_bin_iterate_elements (GST_BIN (comp));
retry_lock: while (G_UNLIKELY (gst_iterator_fold (children,
if (G_UNLIKELY (gst_iterator_fold (children,
(GstIteratorFoldFunction) lock_child_state, NULL, (GstIteratorFoldFunction) lock_child_state, NULL,
NULL) == GST_ITERATOR_RESYNC)) { NULL) == GST_ITERATOR_RESYNC)) {
gst_iterator_resync (children); gst_iterator_resync (children);
goto retry_lock;
} }
gst_iterator_free (children); gst_iterator_free (children);
/* Set caps on all objects */ /* Set caps on all objects */
if (G_UNLIKELY (!gst_caps_is_any (GNL_OBJECT (comp)->caps))) { if (G_UNLIKELY (!gst_caps_is_any (GNL_OBJECT (comp)->caps))) {
children = gst_bin_iterate_elements (GST_BIN (comp)); children = gst_bin_iterate_elements (GST_BIN (comp));
retry_caps: while (G_UNLIKELY (gst_iterator_fold (children,
if (G_UNLIKELY (gst_iterator_fold (children,
(GstIteratorFoldFunction) set_child_caps, NULL, (GstIteratorFoldFunction) set_child_caps, NULL,
comp) == GST_ITERATOR_RESYNC)) { comp) == GST_ITERATOR_RESYNC)) {
gst_iterator_resync (children); gst_iterator_resync (children);
goto retry_caps;
} }
gst_iterator_free (children); gst_iterator_free (children);
} }