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 788434 - bin: iterate_sorted: Ensure sources are always returned last
bin: iterate_sorted: Ensure sources are always returned last
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
unspecified
Other All
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-10-02 16:03 UTC by Edward Hervey
Modified: 2017-10-03 06:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bin: iterate_sorted: Ensure sources are always returned last (4.09 KB, patch)
2017-10-02 16:03 UTC, Edward Hervey
committed Details | Review

Description Edward Hervey 2017-10-02 16:03:40 UTC
See patch message
Comment 1 Edward Hervey 2017-10-02 16:03:45 UTC
Created attachment 360789 [details] [review]
bin: iterate_sorted: Ensure sources are always returned last

For linked elements, the resulting gst_bin_iterate_sorted() will
properly return elements from sink to sources.

If we have some elements that are not linked, we *still* want to
ensure that we return:
* In priority any sinks
* Last of all any sources
* And in between any element which is neither source nor sink

For this to work, when looking for the next candidate element,
not only check the degree order, but if there are two candidates
with the same degree order, prefer the non-source one.

Amongst other things, this fixes the case where we activating a
bin containing unlinked sources and other elements. Without this
we could end up activating sources (which might start adding pads
to be linked) before other (to which those new source element pads
might be linked) are not activated
Comment 2 Nicolas Dufresne (ndufresne) 2017-10-03 00:26:15 UTC
Nice one, good catch.
Comment 3 Edward Hervey 2017-10-03 06:09:44 UTC
Comment on attachment 360789 [details] [review]
bin: iterate_sorted: Ensure sources are always returned last

commit ebad8c0094597c98447d8afb4ba73a757621359f (HEAD -> master, origin/master, origin/HEAD)
Author: Edward Hervey <edward@centricular.com>
Date:   Mon Oct 2 17:59:17 2017 +0200

    bin: iterate_sorted: Ensure sources are always returned last
    
    For linked elements, the resulting gst_bin_iterate_sorted() will
    properly return elements from sink to sources.
    
    If we have some elements that are not linked, we *still* want to
    ensure that we return:
    * In priority any sinks
    * Last of all any sources
    * And in between any element which is neither source nor sink
    
    For this to work, when looking for the next candidate element,
    not only check the degree order, but if there are two candidates
    with the same degree order, prefer the non-source one.
    
    Amongst other things, this fixes the case where we activating a
    bin containing unlinked sources and other elements. Without this
    we could end up activating sources (which might start adding pads
    to be linked) before other (to which those new source element pads
    might be linked) are not activated
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788434