gstreamer rtsp client crash

David Hubberstey david.hubberstey at denbridgemarine.com
Tue May 31 13:03:28 UTC 2016


Hi.

Im currently trying to get an rtsp stream to play in my code using the
gstreamer C libraries and am experiencing a crash of the application when
the stream is set to playing.

The crash does not happen when I launch gstreamer through the command line
using any of the following:

gst-launch-1.0 uridecodebin uri="rtsp://localhost:8554/slamtv60.264" !
autovideosink

gst-launch-1.0 playbin uri="rtsp://localhost:8554/slamtv60.264"

gst-launch-1.0 rtspsrc location=rtsp://localhost:8554/slamtv60.264 !
decodebin ! autovideosink

The code I have used that causes the crash is at the bottom of this
message. Its basically a modified version of the example code with me using
the uridecodebin instead of the standard playbin. I've also tried to use
the playbin and set the uri property but the application still crashes at
what I think is the same place.

I've run the code with GST_DEBUG=4 set and attached the a txt file with the
output to this message in case it will help.

My OS is SuSE linux-leap 42.1 and I'm using the latest gstreamer libraries
from the pacman repo.

Thanks in advance for any help that you can provide.

Dave

#include <gst/gst.h>


struct PipelineData {

  GstElement *pipeline;

  GstElement *source;

  GstElement *sink;

};


int main(int argc, char *argv[])

{

    /* Initialize GStreamer */

    PipelineData data;

    GstBus *bus;

    GstMessage *msg;

    GstStateChangeReturn ret;

    gboolean terminate = FALSE;


    /* Initialize GStreamer */

    gst_init (&argc, &argv);


    /* Create the elements */

    data.source = gst_element_factory_make ("uridecodebin", "source");

    data.sink = gst_element_factory_make ("autovideosink", "sink");


    /* Create the empty pipeline */

    data.pipeline = gst_pipeline_new ("test-pipeline");


    if (!data.pipeline || !data.source || !data.sink)

    {

        g_printerr ("Not all elements could be created.\n");

        return -1;

    }


    /* Build the pipeline */

    gst_bin_add_many (GST_BIN (data.pipeline), data.source, data.sink, NULL);

    /*if (gst_element_link (data.source, data.sink) != TRUE)

    {

        g_printerr ("Elements could not be linked.\n");

        gst_object_unref (data.pipeline);

        return -1;

    }*/


    /* Modify the source's properties */

    g_object_set (data.source, "uri",
"rtsp://localhost:8554/slamtv60.264", NULL);


    /* Connect to the pad-added signal */

    g_signal_connect (data.source, "pad-added", G_CALLBACK
(pad_added_handler), &data);


    /* Start playing */

    ret = gst_element_set_state (data.pipeline, GST_STATE_PLAYING);

    if (ret == GST_STATE_CHANGE_FAILURE)

    {

        g_printerr ("Unable to set the pipeline to the playing state.\n");

        gst_object_unref (data.pipeline);

        return -1;

    }


    /* Listen to the bus */

    bus = gst_element_get_bus (data.pipeline);

    do

    {

        msg = gst_bus_timed_pop_filtered(bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_ERROR);


        /* Parse message */

        if (msg != NULL)

        {

            GError *err;

            gchar *debug_info;


            switch (GST_MESSAGE_TYPE (msg))

            {

            case GST_MESSAGE_ERROR:

                gst_message_parse_error (msg, &err, &debug_info);

                g_printerr ("Error received from element %s: %s\n",
GST_OBJECT_NAME (msg->src), err->message);

                g_printerr ("Debugging information: %s\n", debug_info
? debug_info : "none");

                g_clear_error (&err);

                g_free (debug_info);

                terminate = TRUE;

                break;

            case GST_MESSAGE_EOS:

                g_print ("End-Of-Stream reached.\n");

                terminate = TRUE;

                break;

            case GST_MESSAGE_STATE_CHANGED:

                /* We are only interested in state-changed messages
from the pipeline */

                if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data.pipeline))

                {

                    GstState old_state, new_state, pending_state;

                    gst_message_parse_state_changed (msg, &old_state,
&new_state, &pending_state);

                    g_print ("Pipeline state changed from %s to
%s:\n", gst_element_state_get_name (old_state),
gst_element_state_get_name (new_state));

                }

                break;

            default:

                /* We should not reach here */

                g_printerr ("Unexpected message received.\n");

                break;

            }


            gst_message_unref (msg);

        }

    } while (!terminate);


    return 0;

}


/* This function will be called by the pad-added signal */

static void pad_added_handler (GstElement *src, GstPad *new_pad,
PipelineData *data)

{

    GstPad *sink_pad = gst_element_get_static_pad (data->sink, "sink");

    GstPadLinkReturn ret;

    GstCaps *new_pad_caps = NULL;

    const gchar *new_pad_type = NULL;


    g_print ("Received new pad '%s' from '%s':\n", GST_PAD_NAME
(new_pad), GST_ELEMENT_NAME (src));

    /* If our converter is already linked, we have nothing to do here */

    if (gst_pad_is_linked (sink_pad))

    {

        g_print ("  We are already linked. Ignoring.\n");

        goto exit;

    }


    /* Attempt the link */

    ret = gst_pad_link (new_pad, sink_pad);

    if (GST_PAD_LINK_FAILED (ret))

        g_print ("  Type is '%s' but link failed.\n", new_pad_type);

    else

        g_print ("  Link succeeded (type '%s').\n", new_pad_type);


    exit:

        /* Unreference the new pad's caps, if we got them */

        if (new_pad_caps != NULL)

            gst_caps_unref (new_pad_caps);


        /* Unreference the sink pad */

        gst_object_unref (sink_pad);

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160531/72621363/attachment-0001.html>
-------------- next part --------------
0:00:00.000034674 13533       0xc85e00 INFO                GST_INIT gst.c:511:init_pre: Initializing GStreamer Core Library version 1.8.1
0:00:00.000072507 13533       0xc85e00 INFO                GST_INIT gst.c:512:init_pre: Using library installed in /usr/lib64
0:00:00.000081140 13533       0xc85e00 INFO                GST_INIT gst.c:523:init_pre: Linux palladium 4.1.20-11-default #1 SMP PREEMPT Fri Mar 18 14:42:07 UTC 2016 (0a392b2) x86_64
0:00:00.000205209 13533       0xc85e00 INFO                GST_INIT gstmessage.c:119:_priv_gst_message_initialize: init messages
0:00:00.000408778 13533       0xc85e00 INFO                GST_INIT gstcontext.c:83:_priv_gst_context_initialize: init contexts
0:00:00.000507615 13533       0xc85e00 INFO      GST_PLUGIN_LOADING gstplugin.c:316:_priv_gst_plugin_initialize: registering 0 static plugins
0:00:00.000550843 13533       0xc85e00 INFO      GST_PLUGIN_LOADING gstplugin.c:224:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.000557954 13533       0xc85e00 INFO      GST_PLUGIN_LOADING gstplugin.c:226:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.000572265 13533       0xc85e00 INFO            GST_REGISTRY gstregistry.c:1723:ensure_current_registry: reading registry cache: /home/david/.cache/gstreamer-1.0/registry.x86_64.bin
0:00:00.005815857 13533       0xc85e00 INFO            GST_REGISTRY gstregistrybinary.c:619:priv_gst_registry_binary_read_cache: loaded /home/david/.cache/gstreamer-1.0/registry.x86_64.bin in 0.005234 seconds
0:00:00.005844251 13533       0xc85e00 INFO            GST_REGISTRY gstregistry.c:1579:scan_and_update_registry: Validating plugins from registry cache: /home/david/.cache/gstreamer-1.0/registry.x86_64.bin
0:00:00.006152270 13533       0xc85e00 INFO            GST_REGISTRY gstregistry.c:1681:scan_and_update_registry: Registry cache has not changed
0:00:00.006160622 13533       0xc85e00 INFO            GST_REGISTRY gstregistry.c:1758:ensure_current_registry: registry reading and updating done, result = 1
0:00:00.006165777 13533       0xc85e00 INFO                GST_INIT gst.c:724:init_post: GLib runtime version: 2.44.1
0:00:00.006170857 13533       0xc85e00 INFO                GST_INIT gst.c:726:init_post: GLib headers version: 2.44.1
0:00:00.006175017 13533       0xc85e00 INFO                GST_INIT gst.c:727:init_post: initialized GStreamer successfully
0:00:00.008567723 13533       0xc85e00 INFO      GST_PLUGIN_LOADING gstplugin.c:842:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstplayback.so" loaded
0:00:00.008579876 13533       0xc85e00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:362:gst_element_factory_create: creating element "uridecodebin" named "source"
0:00:00.009055482 13533       0xc85e00 INFO      GST_PLUGIN_LOADING gstplugin.c:842:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstautodetect.so" loaded
0:00:00.009066916 13533       0xc85e00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:362:gst_element_factory_create: creating element "autovideosink" named "sink"
0:00:00.009109323 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstelement.c:659:gst_element_add_pad:<sink> adding pad 'sink'
0:00:00.009767869 13533       0xc85e00 INFO      GST_PLUGIN_LOADING gstplugin.c:842:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstcoreelements.so" loaded
0:00:00.009779763 13533       0xc85e00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:362:gst_element_factory_create: creating element "fakesink" named "fake-video-sink"
0:00:00.009830283 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstelement.c:659:gst_element_add_pad:<GstBaseSink at 0xe11610> adding pad 'sink'
0:00:00.009850119 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstelement.c:907:gst_element_get_static_pad: found pad fake-video-sink:sink
0:00:00.009857371 13533       0xc85e00 INFO                GST_PADS gstpad.c:2312:gst_pad_link_prepare: trying to link sink:proxypad0 and fake-video-sink:sink
0:00:00.009863553 13533       0xc85e00 INFO                GST_PADS gstpad.c:2518:gst_pad_link_full: linked sink:proxypad0 and fake-video-sink:sink, successful
0:00:00.009869085 13533       0xc85e00 INFO               GST_EVENT gstevent.c:1382:gst_event_new_reconfigure: creating reconfigure event
0:00:00.009878307 13533       0xc85e00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:362:gst_element_factory_create: creating element "pipeline" named "test-pipeline"
0:00:00.009918272 13533       0xc85e00 INFO              GST_STATES gstbin.c:2316:gst_bin_element_set_state:<sink> current NULL pending VOID_PENDING, desired next READY
0:00:00.009928339 13533       0xc85e00 INFO              GST_STATES gstelement.c:2372:gst_element_continue_state:<fake-video-sink> completed state change to NULL
0:00:00.009935130 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstpad.c:2068:gst_pad_unlink: unlinking sink:proxypad0(0xe0c130) and fake-video-sink:sink(0xe12060)
0:00:00.009941607 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstpad.c:2122:gst_pad_unlink: unlinked sink:proxypad0 and fake-video-sink:sink
0:00:00.009947039 13533       0xc85e00 INFO           GST_PARENTAGE gstbin.c:1630:gst_bin_remove_func:<sink> removed child "fake-video-sink"
0:00:00.009952598 13533       0xc85e00 INFO         GST_REFCOUNTING gstelement.c:2947:gst_element_dispose:<fake-video-sink> dispose
0:00:00.009957055 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstelement.c:776:gst_element_remove_pad:<fake-video-sink> removing pad 'sink'
0:00:00.009967112 13533       0xc85e00 INFO         GST_REFCOUNTING gstelement.c:2992:gst_element_dispose:<fake-video-sink> parent class dispose
0:00:00.009971650 13533       0xc85e00 INFO         GST_REFCOUNTING gstelement.c:3023:gst_element_finalize:<fake-video-sink> finalize
0:00:00.009975496 13533       0xc85e00 INFO         GST_REFCOUNTING gstelement.c:3028:gst_element_finalize:<fake-video-sink> finalize parent
0:00:00.010622121 13533       0xc85e00 INFO      GST_PLUGIN_LOADING gstplugin.c:842:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstxvimagesink.so" loaded
0:00:00.010633791 13533       0xc85e00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:362:gst_element_factory_create: creating element "xvimagesink" named "sink-actual-sink-xvimage"
0:00:00.010696024 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstelement.c:659:gst_element_add_pad:<GstBaseSink at 0xe1c220> adding pad 'sink'
0:00:00.010708694 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstelement.c:907:gst_element_get_static_pad: found pad sink-actual-sink-xvimage:sink
0:00:00.011864398 13533       0xc85e00 INFO              GST_STATES gstelement.c:2372:gst_element_continue_state:<sink-actual-sink-xvimage> completed state change to READY
0:00:00.011877624 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<sink-actual-sink-xvimage> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.011906991 13533       0xc85e00 INFO        GST_ELEMENT_PADS gstelement.c:907:gst_element_get_static_pad: found pad sink-actual-sink-xvimage:sink
0:00:00.011916139 13533       0xc85e00 INFO                GST_PADS gstpad.c:2312:gst_pad_link_prepare: trying to link sink:proxypad0 and sink-actual-sink-xvimage:sink
0:00:00.011923273 13533       0xc85e00 INFO                GST_PADS gstpad.c:2518:gst_pad_link_full: linked sink:proxypad0 and sink-actual-sink-xvimage:sink, successful
0:00:00.011929136 13533       0xc85e00 INFO               GST_EVENT gstevent.c:1382:gst_event_new_reconfigure: creating reconfigure event
0:00:00.011938986 13533       0xc85e00 INFO              GST_STATES gstbin.c:2316:gst_bin_element_set_state:<sink-actual-sink-xvimage> current READY pending VOID_PENDING, desired next READY
0:00:00.011945347 13533       0xc85e00 INFO              GST_STATES gstbin.c:2433:gst_bin_element_set_state:<sink-actual-sink-xvimage> skipping transition from READY to  READY
0:00:00.011950209 13533       0xc85e00 INFO              GST_STATES gstbin.c:2764:gst_bin_change_state_func:<sink> child 'sink-actual-sink-xvimage' changed state to 2(READY) successfully
0:00:00.011957885 13533       0xc85e00 INFO              GST_STATES gstelement.c:2372:gst_element_continue_state:<sink> completed state change to READY
0:00:00.011962764 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<sink> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.011972172 13533       0xc85e00 INFO              GST_STATES gstbin.c:2764:gst_bin_change_state_func:<test-pipeline> child 'sink' changed state to 2(READY) successfully
0:00:00.011978462 13533       0xc85e00 INFO              GST_STATES gstbin.c:2316:gst_bin_element_set_state:<source> current NULL pending VOID_PENDING, desired next READY
0:00:00.011985967 13533       0xc85e00 INFO              GST_STATES gstelement.c:2372:gst_element_continue_state:<source> completed state change to READY
0:00:00.011990735 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<source> notifying about state-changed NULL to READY (VOID_PENDING pending)
0:00:00.011997208 13533       0xc85e00 INFO              GST_STATES gstbin.c:2764:gst_bin_change_state_func:<test-pipeline> child 'source' changed state to 2(READY) successfully
0:00:00.012003572 13533       0xc85e00 INFO              GST_STATES gstelement.c:2347:gst_element_continue_state:<test-pipeline> committing state from NULL to READY, pending PLAYING, next PAUSED
0:00:00.012009343 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<test-pipeline> notifying about state-changed NULL to READY (PLAYING pending)
0:00:00.012015114 13533       0xc85e00 INFO              GST_STATES gstelement.c:2354:gst_element_continue_state:<test-pipeline> continue state change READY to PAUSED, final PLAYING
0:00:00.012022320 13533       0xc85e00 INFO              GST_STATES gstbin.c:2316:gst_bin_element_set_state:<sink> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.012029429 13533       0xc85e00 INFO              GST_STATES gstbin.c:2316:gst_bin_element_set_state:<sink-actual-sink-xvimage> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.012038861 13533       0xc85e00 INFO              GST_STATES gstbin.c:2770:gst_bin_change_state_func:<sink> child 'sink-actual-sink-xvimage' is changing state asynchronously to PAUSED
0:00:00.012046657 13533       0xc85e00 INFO              GST_STATES gstbin.c:2770:gst_bin_change_state_func:<test-pipeline> child 'sink' is changing state asynchronously to PAUSED
0:00:00.012052381 13533       0xc85e00 INFO              GST_STATES gstbin.c:2316:gst_bin_element_set_state:<source> current READY pending VOID_PENDING, desired next PAUSED
0:00:00.014332700 13533       0xc85e00 INFO      GST_PLUGIN_LOADING gstplugin.c:842:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib64/gstreamer-1.0/libgstrtsp.so" loaded
0:00:00.014345306 13533       0xc85e00 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:362:gst_element_factory_create: creating element "rtspsrc" named "source"
0:00:00.014518085 13533       0xc85e00 INFO                    task gsttask.c:451:gst_task_set_lock: setting stream lock 0xe3fcc8 on task 0xe41050
0:00:00.014541360 13533       0xc85e00 INFO              GST_STATES gstelement.c:2347:gst_element_continue_state:<source> committing state from NULL to READY, pending PAUSED, next PAUSED
0:00:00.014548672 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<source> notifying about state-changed NULL to READY (PAUSED pending)
0:00:00.014556622 13533       0xc85e00 INFO              GST_STATES gstelement.c:2354:gst_element_continue_state:<source> continue state change READY to PAUSED, final PAUSED
0:00:00.014716783 13533       0xc85e00 INFO              GST_STATES gstelement.c:2372:gst_element_continue_state:<source> completed state change to PAUSED
0:00:00.014724537 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<source> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.014747073 13533       0xc85e00 INFO              GST_STATES gstbin.c:3238:bin_handle_async_done:<source> committing state from READY to PAUSED, old pending PAUSED
0:00:00.014753190 13533       0xc85e00 INFO              GST_STATES gstbin.c:3258:bin_handle_async_done:<source> completed state change, pending VOID
0:00:00.014757144 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<source> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.014763725 13533       0xc85e00 INFO              GST_STATES gstelement.c:2362:gst_element_continue_state:<source> nothing pending
0:00:00.014768021 13533       0xc85e00 INFO              GST_STATES gstbin.c:2807:gst_bin_change_state_func:<test-pipeline> child 'source' changed state to 3(PAUSED) successfully without preroll
0:00:00.014775329 13533       0xc85e00 INFO              GST_STATES gstelement.c:2347:gst_element_continue_state:<test-pipeline> committing state from READY to PAUSED, pending PLAYING, next PLAYING
0:00:00.014781486 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<test-pipeline> notifying about state-changed READY to PAUSED (PLAYING pending)
0:00:00.014788141 13533       0xc85e00 INFO              GST_STATES gstelement.c:2354:gst_element_continue_state:<test-pipeline> continue state change PAUSED to PLAYING, final PLAYING
0:00:00.014870571 13533       0xc85e00 INFO               GST_EVENT gstevent.c:1253:gst_event_new_latency: creating latency event 0:00:00.000000000
0:00:00.014893600 13533       0xc85e00 INFO                     bin gstbin.c:2593:gst_bin_do_latency_func:<test-pipeline> configured latency of 0:00:00.000000000
0:00:00.014905663 13533       0xc85e00 INFO              GST_STATES gstbin.c:2316:gst_bin_element_set_state:<sink> current READY pending PAUSED, desired next PLAYING
0:00:00.014911793 13533       0xc85e00 INFO              GST_STATES gstbin.c:2770:gst_bin_change_state_func:<test-pipeline> child 'sink' is changing state asynchronously to PLAYING
0:00:00.014925733 13533       0xc85e00 INFO              GST_STATES gstelement.c:2372:gst_element_continue_state:<source> completed state change to PLAYING
0:00:00.014931435 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<source> notifying about state-changed PAUSED to PLAYING (VOID_PENDING pending)
0:00:00.014938758 13533       0xc85e00 INFO              GST_STATES gstbin.c:2764:gst_bin_change_state_func:<source> child 'source' changed state to 4(PLAYING) successfully
0:00:00.014944766 13533       0xc85e00 INFO              GST_STATES gstelement.c:2372:gst_element_continue_state:<source> completed state change to PLAYING
0:00:00.014949094 13533       0xc85e00 INFO              GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<source> notifying about state-changed PAUSED to PLAYING (VOID_PENDING pending)
0:00:00.014955218 13533       0xc85e00 INFO              GST_STATES gstbin.c:2764:gst_bin_change_state_func:<test-pipeline> child 'source' changed state to 4(PLAYING) successfully
Segmentation fault (core dumped)


More information about the gstreamer-devel mailing list