Null src caps in pad_added for hsldemux2

Flash flashick at gmail.com
Thu Mar 2 12:04:14 UTC 2023


My code is is similar to tutorial 3 and schematically looks like this:
 - build of elements
 - add and link them to pipeline
 - add connect_pad_added handler for hlsdemux2
 - change pipeline state to Playing
According to debugging, pipeline changes its state from null to ready, then
pad_added handler is triggered, and throws an error because current_caps()
returns null.
If I do not request caps, then everything works and pads will be attached
successfully. I can determine the mediatype by pad name, "audio_00" or
"video_00", but in this case I have to use hardcode for decoder, so its
works only for test hls stream.

I forgot to mention one detail - the source is Live Stream hls so I set
STREAMS_AWARE bin flag  for it. Maybe this affects something.
Also i tried to add add_probe handler on gst::PadProbeType::EVENT_BOTH to
hlsddemux2 src pad. It displays caps at each trigger. And result is:
For hlsdemux2:
https://imgbox.com/Ee9Uz3Gd
For uridecodebin3:
https://imgbox.com/1VBWZqCK

It turns out that for uridecodebin3 caps set immediately, and for Demuxer
only after some time.


ср, 1 мар. 2023 г. в 23:58, Nicolas Dufresne <nicolas at ndufresne.ca>:

> Le mercredi 01 mars 2023 à 14:58 +0300, Flash via gstreamer-devel a écrit :
> > Hi!
> > I am trying to reproduce part of uridecodebin3 pipeline. Something like
> > souphttp => typefind => hlsdemux => multiqueue => %some_decoders%
> >
> >  When I call current_caps() in pad_add handler (like in Basic
> tutorial #3),
> > the response always is null.
> > Part of debug output:
> > 0:00:03.780275220  9547 0x7fddd86411e0 INFO        GST_ELEMENT_PADS
> > gstelement.c:758:gst_element_add_pad:<hlsdemux2> adding pad 'video_00'
> > 0:00:03.780281654  9547 0x7fddd86411e0 DEBUG        GST_REFCOUNTING
> > gstobject.c:708:gst_object_set_parent:<'':video_00> set parent (ref and
> sink)
> > 0:00:03.780292735  9547 0x7fddd86411e0 DEBUG               GST_PADS
> > gstpad.c:1103:gst_pad_set_active:<hlsdemux2:video_00> activating pad
> from none
> > 0:00:03.780298194  9547 0x7fddd86411e0 DEBUG               GST_PADS
> > gstpad.c:1008:pre_activate:<hlsdemux2:video_00> setting pad into push
> mode,
> > unset flushing
> > 0:00:03.803780278  9547 0x7fddd86411e0 DEBUG               GST_PADS
> > gstpad.c:1231:activate_mode_internal:<hlsdemux2:video_00> activated in
> push
> > mode
> > 0:00:03.803821999  9547 0x7fddd86411e0 DEBUG               GST_CAPS
> > gstpad.c:2742:gst_pad_get_current_caps:<hlsdemux2:video_00> get current
> pad
> > caps (NULL)
> >
> > The pads do successfully link, however.
> > But to understand which decoder (h264? hevc? aac?) to use, I need to
> know what
> > the output of the demuxer pads is. How to get these caps?
>
> current_caps() is set after that CAPS event have passed through the pad.
> Have
> you started your pipeline ? Also, playbin3 uses StreamCollection instead of
> waiting for pads to appear.
>
> >
> > In the handler for uridecodebin, caps return normally.
> > Gstreamer version: 1.22.0
> > Language: rust
> >
> > Is there some kind of magic here? Or am I just doing something wrong?
> >
> > --
> > Regards
> > Flashick
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230302/a50f7ff4/attachment.htm>


More information about the gstreamer-devel mailing list