From 2f947f3993fd756e247a8a76b0110954a014fa6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 18 Apr 2011 09:53:55 +0200 Subject: [PATCH] element: If activating one pad failed error out early instead of trying to activate the next pads If one pad fails to activate the complete activation process will fail anyway and trying to activate the other pads only wastes time. --- gst/gstelement.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gst/gstelement.c b/gst/gstelement.c index 12fc6fa..c2a8eb3 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -2793,18 +2793,18 @@ invalid_return: } /* gst_iterator_fold functions for pads_activate - * Note how we don't stop the iterator when we fail an activation. This is - * probably a FIXME since when one pad activation fails, we don't want to - * continue our state change. */ + * Stop the iterator if activating one pad failed. */ static gboolean activate_pads (GstPad * pad, GValue * ret, gboolean * active) { - if (!gst_pad_set_active (pad, *active)) + gboolean cont = TRUE; + + if (!(cont = gst_pad_set_active (pad, *active))) g_value_set_boolean (ret, FALSE); /* unref the object that was reffed for us by _fold */ gst_object_unref (pad); - return TRUE; + return cont; } /* set the caps on the pad to NULL */ @@ -2816,8 +2816,7 @@ clear_caps (GstPad * pad, GValue * ret, gboolean * active) return TRUE; } -/* returns false on error or early cutout (will never happen because the fold - * function always returns TRUE, see FIXME above) of the fold, true if all +/* returns false on error or early cutout of the fold, true if all * pads in @iter were (de)activated successfully. */ static gboolean iterator_activate_fold_with_resync (GstIterator * iter, -- 2.7.4