gstreamer1.0 rtspsrc reset/restart/reuse

Sebastian Dröge sebastian at centricular.com
Thu Nov 7 00:04:57 PST 2013


On Mi, 2013-11-06 at 15:45 -0800, DarwinsBuddy wrote:
> [...]

For some reason nabble did not include the code and the output in the
mail. It would be better if you subscribed to the list and just used a
normal mail application.


>         gst_bin_remove(GST_BIN(streamer->pipeline), streamer->sources[streamer->counter]);    
>         
>         [...]
> 
>         gst_bin_add(GST_BIN(streamer->pipeline), streamer->sources[streamer->counter]);
>
> The first transition from source[0] to source[1] succeeds, but the second
> from source[1] to source[0] (there are only 2 rtspsrc elements) fails with
> following output:
> 
> [...]
> (streamer:5915): GStreamer-CRITICAL **: gst_bin_add: assertion `GST_IS_ELEMENT (element)' failed
> [...]
> 
> I assume, that I cannot use an rtspsrc with the state transitions
> NULL->PLAYING->NULL->PLAYING.
> But how can I accomplish it to "restart" the rtspsrc or to again start
> playing after I removed it from and added it again to the pipeline (incl.
> linking the pads again).

The problem is that gst_bin_add() takes ownership of the reference, so
your array does not own a reference to the source anymore after that.
gst_bin_remove() then makes the bin unref the source, and as nothing
else holds a reference it is destroyed.

To prevent that e.g. do gst_bin_add(bin, gst_object_ref(source)) and in
the end unref the reference you have in your array when you're done with
that source forever.

-- 
Sebastian Dröge <sebastian at centricular.com>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131107/2f671715/attachment-0001.pgp>


More information about the gstreamer-devel mailing list