GstGhostPad with no target stops pipeline entering the PLAYING state - how do I work around this?

Graham Leggett minfrin at sharp.fm
Sun May 14 19:16:44 UTC 2017


Hi all,

I have a transcoder bin that encapsulates decodebin, and what I want to do is “tap off” raw streams and perform actions with them, like this:

somesrc ! transcoder name=transcoder ! somesink    transcoder. ! capsfilter caps=video/x-raw ! othersink

The pipeline above is static, but the decodebin buried inside transcoder is dynamic. What I want to achieve is to hide the dynamic nature of decodebin: when a video/x-raw is present, I want it to flow to othersink, but when a video/x-raw is absent, I want the pipeline to do nothing until the video/x-raw is present again.

So far, the source template looks like this:

static GstStaticPadTemplate gst_transcoder_src_template =
GST_STATIC_PAD_TEMPLATE ("src_%u",
    GST_PAD_SRC,
    GST_PAD_REQUEST,
    GST_STATIC_CAPS_ANY);

There is a request_new_pad() function that responds by creating a ghost pad, ready for the target to be wired up when the video stream appears.

The problem I have is that if there is no target on one of the ghost pads (for example, the ghost pad wants video but there is no video in the stream), the transcoder element never enters the PLAYING state, and while data flows into transcoder, nothing flows out of transcoder. The pipeline stalls when the buffers get full.

What is the correct way to handle a pad that you want to exist, but don’t want to use at the moment?

To use the common water analogy, I have a bunch of pipes set up to handle video, but when there is no video I expect no video to flow through these pipes, but I want the audio to flow down the other pipes.

If the video disappears from the stream I want to shut off the video pipe again, but leave the stream in place until video starts arriving again.

I’d tried setting the active on the ghost pads to FALSE, but this makes no difference, the pipeline refuses to enter the PLAYING state, and the change_state() callback in transcoder is never called.

What is the “right” way to do this?

Regards,
Graham
—

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3240 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170514/f1b62564/attachment.bin>


More information about the gstreamer-devel mailing list