[gst-devel] gstrtpbin

Branko Subasic branko.subasic at axis.com
Thu Dec 4 09:58:52 CET 2008

Hi everyone,

I'm in the process of modifying an RTSP-server application that uses
gstrtpbin to stream audio and video. Initially each stream was a 
separate pipeline with it's own gstrtbin, which made it easy to start 
and stop the streams individually. But, for several reasons, I have now
changed it so that all streams are run in the same pipeline, using one 

I still want to be able to start and stop the individual streams though.
I have solved it in the following way:

When a stream is set up the elements are added to the pipeline and then 
linked together. The gstrtpbin is created when the first stream is set
up. The stream's rtp and rtcp sources are linked to the gstrtpbin using

Once a stream is added to the pipeline the state of it's source and rtcp
source elements is locked (using gst_element_set_locked_state()) so
that state changes of the pipeline does not affect them. Thus I can
start and stop the streams individually by setting these two elements to

When the first stream is started the whole pipeline is set to PLAING 
state and will remain in that state.

When a stream is teared down it's elements are first set in NULL state
and then the elements are removed from the pipline using 
gst_bin_remove_many(), which unlinks the elements and removes them from
the pipeline. When the last stream is unlinked the whole pipeline is

After some fiddling around with details it now works fine as far as I
can tell. No GStreamer criticlas anymore, no warnings :-)

My question now is ... is this the way to do it?
Is there an better way to handle the different streams individualy in 
one pipeline?

Have I missed something when removing a stream from the pipeline?
Do I have to unlink and remove the elements linked to the gstrtpbin
individually, or is it OK to use gst_bin_remove_many() to do it?

All views and suggestions are welcome.

Best regards

More information about the gstreamer-devel mailing list