GNOME Bugzilla – Bug 142514
GStreamer segfaults when linking elements from the tail to the head of a pipeline
Last modified: 2004-12-22 21:47:04 UTC
When using a tee element, linking an element to its sink pad AFTER a source has already been linked to it makes it segfault when setting the pipeline to state PLAYING. When the sink pad is linked to an element BEFORE the source has been linked, the tee works as expected. Example of a tee that works (sink pad linked BEFORE the source): tee_works.c: #include <gst/gst.h> int main (int argc, char *argv[]) { GstElement *pipeline, *sine, *tee, *audiosink; GstPad *src, *sink; gst_init (&argc, &argv); pipeline = gst_pipeline_new ("main"); sine = gst_element_factory_make ("sinesrc", "source"); tee = gst_element_factory_make ("tee", "splitter"); audiosink = gst_element_factory_make ("alsasink", "ouput"); gst_bin_add_many (GST_BIN(pipeline), sine, tee, audiosink, NULL); /* Linking the elements */ /* Linking the sink of the tee BEFORE requesting and linking a source pad */ gst_element_link_many (sine, tee, NULL); sink = gst_element_get_pad (audiosink, "sink"); src = gst_element_get_request_pad (tee, "src%d"); gst_pad_link (src, sink); gst_element_set_state (pipeline, GST_STATE_PLAYING); while (gst_bin_iterate (GST_BIN (pipeline))); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); return 0; } Example of a tee that causes a segmentation fault (sink pad linked AFTER a source pad has been linked): tee_segfaults.c: #include <gst/gst.h> int main (int argc, char *argv[]) { GstElement *pipeline, *sine, *tee, *audiosink; GstPad *src, *sink; gst_init (&argc, &argv); pipeline = gst_pipeline_new ("main"); sine = gst_element_factory_make ("sinesrc", "source"); tee = gst_element_factory_make ("tee", "splitter"); audiosink = gst_element_factory_make ("alsasink", "ouput"); gst_bin_add_many (GST_BIN(pipeline), sine, tee, audiosink, NULL); /* Linking the elements */ sink = gst_element_get_pad (audiosink, "sink"); src = gst_element_get_request_pad (tee, "src%d"); gst_pad_link (src, sink); /* Linking the sink of the tee AFTER a source pad has been requested and linked */ gst_element_link_many (sine, tee, NULL); gst_element_set_state (pipeline, GST_STATE_PLAYING); while (gst_bin_iterate (GST_BIN (pipeline))); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (GST_OBJECT (pipeline)); return 0; } The sample code above has been attached to the bug. The code was compiled using gstreamer 0.8.1, compiled with gcc 3.3.3 Command line used to compile: gcc -o works -Wall -g `pkg-config --cflags --libs gstreamer-0.8` tee_works.c gcc -o works -Wall -g `pkg-config --cflags --libs gstreamer-0.8` tee_segfaults.c
Created attachment 27683 [details] Source of the sample code that works as expected
Created attachment 27684 [details] Source of the sample code that causes a segmentation fault
This is a bug with the opt scheduler, --gst-scheduler=entrygthread makes it work. *** This bug has been marked as a duplicate of 138012 ***