stop pipeline into a callback funtion.

Tim Müller tim at centricular.com
Thu Sep 17 01:27:16 PDT 2015


On Thu, 2015-09-17 at 09:55 +0200, Guillermo Rodriguez Garcia wrote:



> 2015-09-16 12:15 GMT+02:00 Alejandro Vázquez <vazlup at gmail.com>:
> > > I want to know if it is right to modify the status of a pipeline
> > > within a
> > callback.
> > The application works but I'm not sure if it can cause a problem in
> > the
> > future.
> > 
> > e.g.
> > 
> > ...
> > GstPad *pad = gst_element_get_static_pad(videoScr, "src");
> > g_signal_connect(pad, "notify::caps", G_CALLBACK(video_changed),
> > NULL);
> > ...
> > 
> > video_changed
> > {
> > ...
> > gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PAUSED);
> > ...
> > }
> 
> The documentation
> (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html
> /chapter-dataaccess.html)
> says the following regarding "data probes":
> 
> "Data probes run in pipeline streaming thread context, so callbacks
> should try to not block and generally not do any weird stuff, since
> this could have a negative impact on pipeline performance or, in case
> of bugs, cause deadlocks or crashes. More precisely, one should
> usually not call any GUI-related functions from within a probe
> callback, nor try to change the state of the pipeline [...]"
> 
> Now what you are using is not a data probe but I do not know if the
> same constrains apply. I couldn't find any information on what can
> and
> can't be done from a callback that was registered with
> g_signal_connect..
> 
> Can anyone shed some light here?

Most signal callbacks on GStreamer objects (other than GstBus::message)
will be emitted from a streaming thread. The notify::caps callback is
one of those that gets emitted from a streaming thread. You can't shut
down the pipeline or change global pipeline state from that callback.

What are you trying to do (big picture)?

 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