Force stopping a gstreamer pipeline

Thomas Scheuermann scheuermann at barco.com
Mon Jun 6 14:45:41 UTC 2016


Hi,

Am 03.06.2016 um 12:59 schrieb Nicolas Dufresne:

Le 3 juin 2016 5:06 AM, "Thomas Scheuermann" <<mailto:scheuermann at barco.com>scheuermann at barco.com<mailto:scheuermann at barco.com>> a écrit :
>
> Hello,
>
> is there a way to force the stopping of a gstreamer pipeline?
> We have here a process running with several pipelines which are started
> and stopped dynamically. Sometimes it happens that when I set the state
> of the pipeline to GST_STATE_NULL (gst_element_set_state(_pipeline,
> GST_STATE_NULL);) this call never comes back.
> What can I do in this situation?
> I use gstreamer 1.8.1
>

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.

Nicolas

Here is a sample code of a deadlock. I think, it is in jackaudiosink.
If you restart the jack daemon while the pipeline is playing, the pipeline can't be stopped anymore.

/*
 * reproducer for deadlock
 *
 * gcc -o deadlock deadlock.c -g `pkg-config --libs --cflags gstreamer-1.0` -Wall
 */
#include <stdio.h>
#include <gst/gst.h>

int main(int argc, char **argv)
{
    GstElement *pipeline;
    GstElement *audiosrc;
    GstElement *audiofilter;
    GstElement *audiosink;
    GstCaps *caps;

    gst_init(&argc, &argv);

    pipeline = gst_pipeline_new("pipeline");
    g_assert(pipeline);

    audiosrc = gst_element_factory_make("audiotestsrc", "audiotestsrc");
    g_assert(audiosrc);

    audiofilter = gst_element_factory_make("capsfilter", "capsfilter");
    g_assert(audiofilter);
    caps = gst_caps_new_simple("audio/x-raw", "channels", G_TYPE_INT, 2, NULL);
    g_object_set(G_OBJECT(audiofilter), "caps",caps, NULL);
    gst_caps_unref(caps);

    audiosink = gst_element_factory_make("jackaudiosink", "jackaudiosink");
    g_assert(audiosink);
    g_object_set(G_OBJECT(audiosink), "client-name", "test", NULL);

    g_print("Adding elements\n");
    gst_bin_add_many(GST_BIN(pipeline), audiosrc, audiofilter, audiosink, NULL);

    gst_element_link_many(audiosrc, audiofilter, audiosink, NULL);

    g_print("Set pipeline state to playing\n");
    gst_element_set_state(pipeline, GST_STATE_PLAYING);

    g_print("Restart jack daemon and press enter\n");
    getchar();

    g_print("Set pipeline state to null\n");
    gst_element_set_state(pipeline, GST_STATE_NULL);
    g_print("Unref pipeline\n");
    gst_object_unref(pipeline);

    return 0;
}


This message is subject to the following terms and conditions: MAIL DISCLAIMER<http://www.barco.com/en/maildisclaimer>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160606/63f1c94c/attachment.html>


More information about the gstreamer-devel mailing list