GNOME Bugzilla – Bug 745042
utils: Add gst_bin_sync_children_states()
Last modified: 2015-03-13 12:49:17 UTC
Created attachment 297701 [details] [review] 0001-utils-Add-gst_bin_sync_children_states.patch gst_bin_sync_children_states() will iterate over all the elements of a bin and sync their states with the state of the bin. This is useful when adding many elements to a bin and would otherwise have to call gst_element_sync_state_with_parent() on each and every one of them.
Also relevant in this context would be bug #722767, as this function will have the same bug/feature inherited from gst_element_sync_state_with_parent().
Review of attachment 297701 [details] [review]: ::: gst/gstutils.c @@ +3091,3 @@ + gboolean success = TRUE; + + it = gst_bin_iterate_elements (bin); As discussed, this should use gst_bin_iterate_sorted(). Otherwise we might change elements states in the wrong order: activate an upstream element, which sends data to a deactivated downstream elements, then gets GST_FLOW_FLUSHING and stops.
Created attachment 298028 [details] [review] Patch v2 Thanks a lot for the comments. New patch attached.
Let's get this in now? Or does anybody see any reason not to? :)
Why not just do "gst_element_get_state(bin, NULL, &blah, 0); gst_element_set_state(bin, blah);" instead?
Because that doesn't do anything with the children if the bin already is in that state.
Should this thing respect locked states?
That's a good question. It probably should or what do you think?
Created attachment 299311 [details] [review] Now respecting locked state Thanks Olivier, made it respect the locked state.
commit 6ec3c4bc66cbbefa6e5811874d9787d675c807ee Author: Vivia Nikolaidou <vivia@ahiru.eu> Date: Mon Feb 23 20:27:32 2015 +0200 utils: Add gst_bin_sync_children_states() gst_bin_sync_children_states() will iterate over all the elements of a bin and sync their states with the state of the bin. This is useful when adding many elements to a bin and would otherwise have to call gst_element_sync_state_with_parent() on each and every one of them. https://bugzilla.gnome.org/show_bug.cgi?id=745042