Activating pads when adding dynamically before entering PAUSED state
Tim Müller
tim at centricular.com
Wed Sep 30 23:57:17 UTC 2020
Hi Tony,
> I've got a simpler question about adding pads dynamically.
> Apparently, when adding a pad to an element, you should call
> gst_pad_set_active(pad, TRUE); and examples show this being called
> before adding the pad. But according to the API this calls its
> activate virtual function. I would have thought a pad should only be
> activated when it's at least entering PAUSED state.
PAUSED is an element state, pads only have active/non-active states
(plus flushing/eos).
> And shouldn't you at least wait until the pipeline's push/pull mode
> has been negotiated?
Pads usually get activated as part of the state change mechanism, when
elements go from READY to PAUSED state.
When pads get activated, they get activated in a mode, i.e. pull mode
or push mode.
Figuring out what mode to activate a pad in is part of the pad
activation / element state change mechanism.
Pipeline state is usually set topologically going element by element
from sink elements towards source elements. At each point, when an
element goes from READY to PAUSED state it will activate the pads, and
in the rare case that the element supports pull mode (mostly only
parser + demuxers + typefind), it will query the element upstream if it
also supports pull mode when activating its sink pad(s), and if not
fall back to push mode.
So the negotiation of the push/pull modes is directly linked to the
pipeline state change propagation mechanism.
> What if I want to add a pad before either of those conditions?
Not sure what conditions those are. If you add a pad before the element
goes to PAUSED it will be activated as part of the state change
mechanism later. You can activate it already of course, but it would be
pointless since there's no streaming going on yet.
I'm not entirely sure what you want to achieve exactly to be honest. As
an application you would typically only activate ghost pads perhaps,
but usually it's the elements who activate pads at runtime before
adding them. Pads that the element doesn't know about rarely make sense
after all.
Cheers
Tim
--
Tim Müller, Centricular Ltd - http://www.centricular.com
More information about the gstreamer-devel
mailing list