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 682629 - decodebin: won't expose unknown pads even with expose-all-streams=true
decodebin: won't expose unknown pads even with expose-all-streams=true
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal major
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-24 18:02 UTC by Matej Knopp
Modified: 2018-05-05 16:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (2.40 KB, patch)
2012-08-24 18:02 UTC, Matej Knopp
needs-work Details | Review

Description Matej Knopp 2012-08-24 18:02:47 UTC
Created attachment 222356 [details] [review]
Patch

I expect decodebin to expose all pads (even those that can't be decoded) when expose-all-streams is true, but it doesn't. Streams with unknown caps are never exposed.
Comment 1 Matej Knopp 2013-04-02 00:33:26 UTC
The patch no longer applies, but it was probably not entirely correct even when it did apply.
The problem still persist though.
Comment 2 Sebastian Dröge (slomo) 2013-04-04 09:35:14 UTC
Review of attachment 222356 [details] [review]:

Looks almost good, I just don't know if there are any negative implications when exposing the unknown streams. Can't think of any right now

::: gst/playback/gstdecodebin2.c
@@ +1459,2 @@
   if (gst_caps_is_any (caps))
     goto any_caps;

This will now crash if caps==NULL

@@ +1460,3 @@
     goto any_caps;
 
   dpad = gst_decode_pad_new (dbin, pad, chain);

And this

@@ -1713,3 @@
-      gst_decode_bin_expose (dbin);
-    }
-    EXPOSE_UNLOCK (dbin);

You should still check if the chain is complete and expose then here
Comment 3 Tim-Philipp Müller 2013-04-04 09:43:46 UTC
> I just don't know if there are any negative implications
> when exposing the unknown streams. Can't think of any right now

Note that this is not (should not be) done by default, but only if the "expose-all-streams" property is set explicitly to TRUE.
Comment 4 Sebastian Dröge (slomo) 2013-04-04 09:52:11 UTC
It is true by default, so we should add a new property? :)
Comment 5 Tim-Philipp Müller 2013-04-04 09:59:40 UTC
Oh, my bad, I thought it was false by default. (Why is it true by default?)
Comment 6 Reynaldo H. Verdejo Pinochet 2013-11-04 16:22:40 UTC
Seems we are still coming short for what expose-all-streams seems
to mean. The current code has at least two seemingly analogous
do-not-expose conditions:

unknown_type: Type unknown, caps could not be fixated to a compatible
set (missing decoder ...)
discarded_type: Type known, no final caps due to failed nego (decoder
present, but stream variant not supported)

if any of these conditions are hit, the pad/stream is not exposed.
And this is where I think we have a problem. expose-all sounds like both
should be exposed no matter what, whereas the current patch only fixes(*)
the behavior for the unknown_type case.

As I see it there are likely 2 ways forward. Either we complete/fix the
patch as it is and change the expose-all-streams name to something more
intuitive like expose-unknown-streams, or we make sure the fix also
handles the discarded_type condition.

What do you think?
Comment 7 Sebastian Dröge (slomo) 2013-11-11 13:18:16 UTC
Edward added the expose-all-streams property a long time ago for discoverer IIRC. Maybe he can explain what his intention was :)


From my understanding both cases Reynaldo mentioned should be exposed if expose-all-streams is TRUE. As this is the default setting this might break existing code in unexpected ways as they suddenly get pads with unknown types.


The current behaviour is that if !expose-all-streams we never expose raw pads, and we never expose pads which have caps for which there is an decoder that does not output final caps. Unless I misunderstand what the code does, this doesn't make any sense at all to me :)
Comment 8 Edward Hervey 2013-11-11 13:24:55 UTC
The goal was to avoid as quickly as possible to add unneeded decoders/streams.

If the final caps are raw video (for example), don't attempt to plug/create audio decoders.

This was added for efficient encodebin and gnonlin usages.
Comment 9 Sebastian Dröge (slomo) 2013-11-11 13:31:25 UTC
(In reply to comment #8)
> The goal was to avoid as quickly as possible to add unneeded decoders/streams.
> 
> If the final caps are raw video (for example), don't attempt to plug/create
> audio decoders.

The code does not do that though. Instead it never exposes 1) raw pads (as with the default raw caps, which include audio/video/text caps), or 2) pads that would be plugged to decoders that don't produce final (i.e. raw) caps.

1) Probably should check not the default raw caps but the signals and the property
2) Is dangerous because it would also not use a pad if there's a single decoder in the list that outputs only silly stuff like video/x-raw(memory:VASurface) and not video/x-raw.

I think the behaviour of that property is currently broken.


Apart from that, what this bug is about apparently is different from what the expose-all-streams property was supposed to solve. And I think we should add a second property for that so that decodebin also exposes pads with unknown types.
Comment 10 Reynaldo H. Verdejo Pinochet 2013-12-20 15:12:10 UTC
Edward, I'm not sure I understand you clearly enough. Can you elaborate
a bit on what do you want this property to do? Idea would be to fix
it to match the original intent and close this one for once and for all.
I should be able to take care of it.
Comment 11 Sebastian Dröge (slomo) 2013-12-20 15:16:51 UTC
Note that the original intent is not what this bug was about, if I understand it correctly. Still what you said should be done first, and then we can add something new but related for this bug.
Comment 12 Edward Hervey 2013-12-20 15:24:39 UTC
The original intent is the following:

You use decodebin (or uridecodebin) in your pipeline (because you don't want to deal with figuring out demuxer, decoder, what to plug, ...).

You only want to use a certain type of stream from it. You set the caps property to the streams you're interested in (say ... just video/x-raw) and set expose-all-streams to False.

This will (or rather "should" based on sebastian's remarks):
1) Only expose pads that match that
2) *remove* all decoders and intermediary elements that are not used

This was done for a performance reason (so you don't have elements you know you'll never ever need around).
Comment 13 Reynaldo H. Verdejo Pinochet 2013-12-20 20:37:46 UTC
OK. Still, the case failing to achieve what the property name
seems to point to is the expose-all-streams = TRUE one. Under
this light, should I go forward and fix this so it properly
exposes the two cases discussed in comment #6?

For reference:

unknown_type: Type unknown, caps could not be fixated to a compatible
set (missing decoder ...)
discarded_type: Type known, no final caps due to failed nego (decoder
present, but stream variant not supported)
Comment 14 Sebastian Dröge (slomo) 2013-12-30 08:28:20 UTC
(In reply to comment #13)
> OK. Still, the case failing to achieve what the property name
> seems to point to is the expose-all-streams = TRUE one. Under
> this light, should I go forward and fix this so it properly
> exposes the two cases discussed in comment #6?

No, first of all it should be fixed to work the way how Edward envisioned it. See my comments above for the broken behaviour.

Then this bug here should be fixed, i.e. provide a new property to select that all (even unknown!) streams should be exposed. We can't do that with the existing expose-all-streams property (==TRUE) because it can easily break existing code. Nothing expects to get arbitrary unknown streams exposed on decodebin, only "raw" and known streams are expected.

Also potentially related bug #710444
Comment 15 Edward Hervey 2018-05-05 16:12:45 UTC
Closing since this isn't an issue with decodebin3.