<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
<div class="moz-cite-prefix">Am 03.06.2016 um 12:59 schrieb Nicolas Dufresne:<br>
</div>
<blockquote cite="mid:CAH_td2w4Lb-4c_97dRHVo9BXZiBiLm7Q5MJQvJtiuU7_+RvVnw@mail.gmail.com" type="cite">
<p dir="ltr"><br>
Le 3 juin 2016 5:06 AM, "Thomas Scheuermann" <<a moz-do-not-send="true" href="mailto:scheuermann@barco.com"></a><a class="moz-txt-link-abbreviated" href="mailto:scheuermann@barco.com">scheuermann@barco.com</a>> a écrit :<br>
><br>
> Hello,<br>
><br>
> is there a way to force the stopping of a gstreamer pipeline?<br>
> We have here a process running with several pipelines which are started<br>
> and stopped dynamically. Sometimes it happens that when I set the state<br>
> of the pipeline to GST_STATE_NULL (gst_element_set_state(_pipeline,<br>
> GST_STATE_NULL);) this call never comes back.<br>
> What can I do in this situation?<br>
> I use gstreamer 1.8.1<br>
></p>
<p dir="ltr">This is a deadlock. It should not happen unless you are doing something wrong in your application, or if you have hit a big in GStreamer. You may want to share a full backtrace.</p>
<p dir="ltr">Nicolas<br>
</p>
</blockquote>
Here is a sample code of a deadlock. I think, it is in jackaudiosink.<br>
If you restart the jack daemon while the pipeline is playing, the pipeline can't be stopped anymore.<br>
<br>
/*<br>
* reproducer for deadlock<br>
*<br>
* gcc -o deadlock deadlock.c -g `pkg-config --libs --cflags gstreamer-1.0` -Wall<br>
*/<br>
#include <stdio.h><br>
#include <gst/gst.h><br>
<br>
int main(int argc, char **argv)<br>
{<br>
GstElement *pipeline;<br>
GstElement *audiosrc;<br>
GstElement *audiofilter;<br>
GstElement *audiosink;<br>
GstCaps *caps;<br>
<br>
gst_init(&argc, &argv);<br>
<br>
pipeline = gst_pipeline_new("pipeline");<br>
g_assert(pipeline);<br>
<br>
audiosrc = gst_element_factory_make("audiotestsrc", "audiotestsrc");<br>
g_assert(audiosrc);<br>
<br>
audiofilter = gst_element_factory_make("capsfilter", "capsfilter");<br>
g_assert(audiofilter);<br>
caps = gst_caps_new_simple("audio/x-raw", "channels", G_TYPE_INT, 2, NULL);<br>
g_object_set(G_OBJECT(audiofilter), "caps",caps, NULL);<br>
gst_caps_unref(caps);<br>
<br>
audiosink = gst_element_factory_make("jackaudiosink", "jackaudiosink");<br>
g_assert(audiosink);<br>
g_object_set(G_OBJECT(audiosink), "client-name", "test", NULL);<br>
<br>
g_print("Adding elements\n");<br>
gst_bin_add_many(GST_BIN(pipeline), audiosrc, audiofilter, audiosink, NULL);<br>
<br>
gst_element_link_many(audiosrc, audiofilter, audiosink, NULL);<br>
<br>
g_print("Set pipeline state to playing\n");<br>
gst_element_set_state(pipeline, GST_STATE_PLAYING);<br>
<br>
g_print("Restart jack daemon and press enter\n");<br>
getchar();<br>
<br>
g_print("Set pipeline state to null\n");<br>
gst_element_set_state(pipeline, GST_STATE_NULL);<br>
g_print("Unref pipeline\n");<br>
gst_object_unref(pipeline);<br>
<br>
return 0;<br>
}<br>
<br>
<br>
This message is subject to the following terms and conditions: <a href="http://www.barco.com/en/maildisclaimer">
MAIL DISCLAIMER</a>
</body>
</html>