After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 745042 - utils: Add gst_bin_sync_children_states()
utils: Add gst_bin_sync_children_states()
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-02-23 18:37 UTC by Vivia Nikolaidou
Modified: 2015-03-13 12:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-utils-Add-gst_bin_sync_children_states.patch (3.24 KB, patch)
2015-02-23 18:37 UTC, Vivia Nikolaidou
none Details | Review
Patch v2 (3.24 KB, patch)
2015-02-26 20:49 UTC, Vivia Nikolaidou
none Details | Review
Now respecting locked state (3.33 KB, patch)
2015-03-13 12:35 UTC, Vivia Nikolaidou
committed Details | Review

Description Vivia Nikolaidou 2015-02-23 18:37:00 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.
Comment 1 Sebastian Dröge (slomo) 2015-02-23 18:41:37 UTC
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().
Comment 2 Sebastian Dröge (slomo) 2015-02-25 13:53:40 UTC
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.
Comment 3 Vivia Nikolaidou 2015-02-26 20:49:05 UTC
Created attachment 298028 [details] [review]
Patch v2

Thanks a lot for the comments. New patch attached.
Comment 4 Sebastian Dröge (slomo) 2015-03-11 10:08:15 UTC
Let's get this in now? Or does anybody see any reason not to? :)
Comment 5 Olivier Crête 2015-03-11 13:29:36 UTC
Why not just do "gst_element_get_state(bin, NULL, &blah, 0); gst_element_set_state(bin, blah);" instead?
Comment 6 Sebastian Dröge (slomo) 2015-03-11 13:56:05 UTC
Because that doesn't do anything with the children if the bin already is in that state.
Comment 7 Olivier Crête 2015-03-11 14:09:29 UTC
Should this thing respect locked states?
Comment 8 Sebastian Dröge (slomo) 2015-03-11 14:15:29 UTC
That's a good question. It probably should or what do you think?
Comment 9 Vivia Nikolaidou 2015-03-13 12:35:14 UTC
Created attachment 299311 [details] [review]
Now respecting locked state

Thanks Olivier, made it respect the locked state.
Comment 10 Sebastian Dröge (slomo) 2015-03-13 12:49:10 UTC
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