Add/remove pipeline branches from tee

Tim Müller tim at centricular.com
Thu Aug 6 03:25:28 PDT 2015


On Thu, 2015-08-06 at 02:43 -0700, petesmah wrote:

Hi Peter,

> I have a pipeline in GStreamer of the following structure:
> 
> rtspsrc -> rtph264depay -> parser -> tee
> -> queue -> (bin - MP4 file)
> -> queue -> (bin - RTP/UDP)
> 
> What I want to be able to is, on interrupt from bus, remove (or add) a
> specified branch.

Is it always the same branch you want to add/remove (e.g. the mp4 file
one for recording)?

> I'm following the gstreamer guide, section 19.4
> 
> When the pipeline first starts playing all is well and everything plays how
> it should. My issue is that when I add a branch, its elements don't get to
> the PLAYING state. They get as far as PAUSED, except for the last element
> which remains at READY. I've tried keeping the queue on the tee and
> unlinking the bin from the queue.

Do you set the state on the elements you add yourself? You need to, the
pipeline won't take care of that for you once it's up and running
already.

The order should be:

 - add new elements to pipeline

 - link new elements (but not yet to tee)

 - set state of elements to PLAYING (assuming the pipeline is in
PLAYING), going from sink towards the queue.

 - lastly, link the queue to the tee.

Another thing: you probably want to set the "async" property of the sink
you add (filesink presumably) to FALSE, this makes sure the addition of
the new sink doesn't mess with the state of the pipeline.

Do you get any error messages posted on the bus in your case?


> When I tried putting the queue in the bin and linking/unlinking from the
> tee, I had issues removing the bin even after blocking the branch and
> sending an EOS.

What issues did you have?

You may find this example useful, it does something similar (and a bit
more):
http://people.freedesktop.org/~tpm/code/test-backlog-recording-h264.c

> How should I go about doing this dynamic branch manipulation?

In case you haven't seen it yet, Sebastian also has some pointers about
the various gotchas here:
https://coaxion.net/blog/2014/01/gstreamer-dynamic-pipelines/

 Cheers
  -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference: 8-9 October 2015 in Dublin, Ireland




More information about the gstreamer-devel mailing list