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 796794 - flowcombiner: update_pad_flow should check that the pad is inside the combiner
flowcombiner: update_pad_flow should check that the pad is inside the combiner
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: git master
Assigned To: Xabier Rodríguez Calvar
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-07-12 08:38 UTC by Xabier Rodríguez Calvar
Modified: 2018-11-03 12:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.16 KB, patch)
2018-07-12 08:38 UTC, Xabier Rodríguez Calvar
none Details | Review
patch (1.07 KB, patch)
2018-07-12 09:01 UTC, Xabier Rodríguez Calvar
none Details | Review
patch 2/2 (4.12 KB, patch)
2018-07-12 09:42 UTC, Xabier Rodríguez Calvar
none Details | Review
patch 2/2 (4.00 KB, patch)
2018-07-12 10:12 UTC, Xabier Rodríguez Calvar
none Details | Review
1/2 migrate flow combiner pads set from GQueue to a sorted GArray (5.27 KB, patch)
2018-07-24 08:41 UTC, Xabier Rodríguez Calvar
none Details | Review
2/2 add check for existing pad in update_pad_flow (1.11 KB, patch)
2018-07-24 08:43 UTC, Xabier Rodríguez Calvar
none Details | Review
1/2 migrate flow combiner pads set from GQueue to a sorted GPtrArray (5.03 KB, patch)
2018-07-24 12:06 UTC, Xabier Rodríguez Calvar
none Details | Review
2/2 add check for existing pad in update_pad_flow (1.13 KB, patch)
2018-07-24 12:07 UTC, Xabier Rodríguez Calvar
none Details | Review

Description Xabier Rodríguez Calvar 2018-07-12 08:38:12 UTC
Created attachment 373000 [details] [review]
patch

Currently it is not doing that and that can create issues
Comment 1 Sebastian Dröge (slomo) 2018-07-12 08:46:24 UTC
Comment on attachment 373000 [details] [review]
patch

Looks good but I would prefer a g_critical() (or a g_return_if_fail()) here. It's a clear programming error, this should never happen :)
Comment 2 Tim-Philipp Müller 2018-07-12 09:00:48 UTC
I wonder if we can do something smarter here? Iterating the list twice for each flow combination just for a sanity check seems potentially expensive and unnecessary to me. Might not matter if it's just a few pads of course, but..
Comment 3 Xabier Rodríguez Calvar 2018-07-12 09:01:16 UTC
Created attachment 373001 [details] [review]
patch

(In reply to Sebastian Dröge (slomo) from comment #1)
> Looks good but I would prefer a g_critical() (or a g_return_if_fail()) here.
> It's a clear programming error, this should never happen :)

Done.
Comment 4 Xabier Rodríguez Calvar 2018-07-12 09:07:40 UTC
(In reply to Tim-Philipp Müller from comment #2)
> I wonder if we can do something smarter here? Iterating the list twice for
> each flow combination just for a sanity check seems potentially expensive
> and unnecessary to me. Might not matter if it's just a few pads of course,
> but..

I don't know how we could do this. Maybe passing the pad thru down to gst_flow_combiner_get_flow but we might be running some other code in-between and bail out before we reach that check.
Comment 5 Xabier Rodríguez Calvar 2018-07-12 09:42:11 UTC
Created attachment 373002 [details] [review]
patch 2/2

(In reply to Xabier Rodríguez Calvar from comment #4)
> (In reply to Tim-Philipp Müller from comment #2)
> > I wonder if we can do something smarter here? Iterating the list twice for
> > each flow combination just for a sanity check seems potentially expensive
> > and unnecessary to me. Might not matter if it's just a few pads of course,
> > but..
> 
> I don't know how we could do this. Maybe passing the pad thru down to
> gst_flow_combiner_get_flow but we might be running some other code
> in-between and bail out before we reach that check.

In my second patch (that would apply on top of the first) I create the unsafe version that avoids the check.
Comment 6 Xabier Rodríguez Calvar 2018-07-12 10:12:01 UTC
Created attachment 373003 [details] [review]
patch 2/2

Rebased against master
Comment 7 Sebastian Dröge (slomo) 2018-07-12 10:31:24 UTC
We could store the pads in a GHashTable ;)
Comment 8 Xabier Rodríguez Calvar 2018-07-12 10:36:31 UTC
(In reply to Sebastian Dröge (slomo) from comment #7)
> We could store the pads in a GHashTable ;)

We could! Maybe some other day! :-p

PS: It's a pity there is not GHashSet, cause in this case we would just need they keys without the values.
Comment 9 Thibault Saunier 2018-07-12 12:43:19 UTC
(In reply to Xabier Rodríguez Calvar from comment #8)

> PS: It's a pity there is not GHashSet, cause in this case we would just need
> they keys without the values.

There is `g_hash_table_add` which aims at offering a "set like" API on top of GHashTable.
Comment 10 Tim-Philipp Müller 2018-07-12 13:02:44 UTC
If the order of the pads does not matter, we could store the pads in a sorted array instead of a list and bisect over it with gst_util_array_binary_search() ;)
Comment 11 Xabier Rodríguez Calvar 2018-07-24 08:41:51 UTC
Created attachment 373134 [details] [review]
1/2 migrate flow combiner pads set from GQueue to a sorted GArray
Comment 12 Xabier Rodríguez Calvar 2018-07-24 08:43:43 UTC
Created attachment 373135 [details] [review]
2/2 add check for existing pad in update_pad_flow

This opens a huge can of worms, at least in qtdemux. I think this should be fixed but I don't think I have the time to address all implications.
Comment 13 Xabier Rodríguez Calvar 2018-07-24 09:24:55 UTC
(In reply to Xabier Rodríguez Calvar from comment #12)
> This opens a huge can of worms, at least in qtdemux. I think this should be
> fixed but I don't think I have the time to address all implications.

Or maybe my patches are buggy...
Comment 14 Tim-Philipp Müller 2018-07-24 09:42:27 UTC
Can't help but wonder if all of this is really worth it? :)
Comment 15 Xabier Rodríguez Calvar 2018-07-24 10:19:09 UTC
(In reply to Tim-Philipp Müller from comment #14)
> Can't help but wonder if all of this is really worth it? :)

Maybe not. We can just let people make programming mistakes. I had submitted a couple of patches you didn't like and recommended to use gst_util_array_binary_search() which is exactly what I did.
Comment 16 Xabier Rodríguez Calvar 2018-07-24 12:06:58 UTC
Created attachment 373140 [details] [review]
1/2 migrate flow combiner pads set from GQueue to a sorted GPtrArray
Comment 17 Xabier Rodríguez Calvar 2018-07-24 12:07:15 UTC
Created attachment 373141 [details] [review]
2/2 add check for existing pad in update_pad_flow
Comment 18 Xabier Rodríguez Calvar 2018-07-24 12:08:03 UTC
These two patches should work, please review if you have a moment.
Comment 19 GStreamer system administrator 2018-11-03 12:47:26 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/303.