GNOME Bugzilla – Bug 650654
gst-rtsp-server segmentation fault when stressed with PAUSE/UNPAUSE
Last modified: 2012-11-20 10:44:54 UTC
From time to time the gst-rtsp-server segfaults when stressed with PAUSE/PLAY requests. I am using Ubuntu 11.04 with GStreamer PPA, gst-rtsp-server is from git. At the server side i run ./test-launch "( videotestsrc ! video/x-raw-yuv, width=640, height=480, framerate=50/1 ! x264enc ! rtph264pay name=pay0 pt=96 )" Client used to reproduce the bug. #include <gst/gst.h> static void element_added_signal(GstBin * bin, GstElement * element, gpointer * user_data); static GMainLoop *loop; static gboolean bus_call (GstBus * bus, GstMessage * msg, gpointer data) { GMainLoop *loop = (GMainLoop *) data; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_EOS:{ g_print ("End-of-stream\n"); g_main_loop_quit (loop); break; } case GST_MESSAGE_ERROR:{ gchar *debug; GError *err; gst_message_parse_error (msg, &err, &debug); g_free (debug); g_print ("Error: %s\n", err->message); g_error_free (err); g_main_loop_quit (loop); break; } default: break; } return TRUE; } static gboolean free_pipeline(gpointer data) { g_main_loop_quit (loop); return FALSE; } static gboolean switch_state(gpointer data) { GstElement *pipeline = (GstElement *) data; static gboolean paused = 0; if (paused) { gst_element_set_state (pipeline, GST_STATE_PLAYING); } else { gst_element_set_state (pipeline, GST_STATE_PAUSED); } paused = !paused; return TRUE; } static void element_added_signal(GstBin * bin, GstElement * element, gpointer * user_data) { char *name; name = gst_element_get_name(element); if (strcmp(name, "uridecodebin0") == 0) { g_signal_connect(element, "element-added", G_CALLBACK(element_added_signal), NULL); } else if (strcmp(name, "source") == 0) { g_object_set(element, "protocols", 0x00000004, NULL); } } gint main (gint argc, gchar * argv[]) { GstElement *pipeline; GstBus *bus; gchar *uri; gst_init (&argc, &argv); pipeline = gst_element_factory_make("playbin2", NULL); g_object_set(pipeline, "uri", "rtsp://192.168.2.27:8554/test/"); g_signal_connect(pipeline, "element-added", G_CALLBACK(element_added_signal), NULL); /* create and event loop and feed gstreamer bus mesages to it */ loop = g_main_loop_new (NULL, FALSE); bus = gst_element_get_bus (pipeline); gst_bus_add_watch (bus, bus_call, loop); g_object_unref (bus); g_timeout_add (30000, free_pipeline, NULL); g_timeout_add (500, switch_state, pipeline); /* start play back and listen to events */ gst_element_set_state (pipeline, GST_STATE_PLAYING); g_main_loop_run (loop); /* cleanup */ gst_element_set_state (pipeline, GST_STATE_NULL); g_object_unref (pipeline); g_main_loop_unref (loop); return 0; } Backtrace
+ Trace 227189
Could you attach a testcase application for the server and client side? Also, could you check in gdb why exactly it crashes there, e.g. which of the variables in the function has obviously invalid values, etc?
I have already attached the testcase for server and client side. The server side is run from a shell, while the client side is a c program. About gdb, currently I am quite busy and I don't have time to debug this error.
The sample doesn't work for me, even after changing the IP in the client code to the correct one: 0:00:00.538873898 5200 0x636270 ERROR rtspsrc gstrtspsrc.c:5511:gst_rtspsrc_open_from_sdp:<source> setup failed
Maybe you don't have x264enc in server side or ffdec_h264 in client side. Could you check that? When you run the client it needs to be run several times until the SEGV appears. Also i have found that line g_object_set(pipeline, "uri", "rtsp://192.168.2.1:8554/test/"); should be g_object_set(pipeline, "uri", "rtsp://192.168.2.1:8554/test/", NULL);
I can't seem to reproduce this anymore, might have been fixed with recent changes.