BadShmSeg when adding textoverlay dynamically
Francisco Velázquez
francisco.javier at me.com
Fri Nov 14 12:46:32 PST 2014
Dear GStreamer community,
I'm trying to add a text overlay on-the-fly but I am getting BadShmSeg error. The most simple pipeline to reproduce this error changes from:
videotestsrc ! ximagesink
to:
videotestsrc ! textoverlay text="Hello World!" ! imagesink.
The code is:
---------------------------
#include <gst/gst.h>
static GstPad *videosrc_blockpad;
static GstElement *videosrc, *videosink, *pipeline, *textoverlay;
static GstPadProbeReturn pad_probe_videosrc_cb(GstPad * videosrc_pad, GstPadProbeInfo * info, gpointer user_data){
/* unlink videotestsrc from ximagesink */
gst_element_set_state(videosink, GST_STATE_NULL);
gst_bin_remove(GST_BIN(pipeline), videosink);
/* adding the textoverlay */
textoverlay = gst_element_factory_make("textoverlay", NULL);
g_object_set(G_OBJECT (textoverlay), "text", "Hello World!", NULL);
gst_bin_add_many(GST_BIN(pipeline), textoverlay, videosink, NULL);
/* inserting the text overlay */
gst_element_link_many(videosrc, textoverlay, videosink, NULL);
/* I might need to setup a GST_STATE_PLAYING again. */
gst_element_set_state(textoverlay, GST_STATE_PLAYING);
gst_element_set_state(videosink, GST_STATE_PLAYING);
gst_debug_set_threshold_from_string ("*:5", TRUE);
return GST_PAD_PROBE_REMOVE;
}
static gboolean timeout_cb (gpointer user_data){
gst_pad_add_probe (videosrc_blockpad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, pad_probe_videosrc_cb, user_data, NULL);
return FALSE;
}
int main (int argc, char **argv){
GMainLoop *loop;
/* init GStreamer */
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
videosrc = gst_element_factory_make("videotestsrc", NULL);
videosrc_blockpad = gst_element_get_static_pad(videosrc, "src");
videosink = gst_element_factory_make("ximagesink", NULL);
pipeline = gst_pipeline_new("pipeline");
gst_bin_add_many(GST_BIN(pipeline), videosrc, videosink, NULL);
gst_element_link_many(videosrc, videosink, NULL);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
g_timeout_add_seconds (5, timeout_cb, loop);
g_main_loop_run (loop);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
—————————
The error log:
….
0:00:06.233014000 [332m43633[00m 0x1020ea230 [37mDEBUG [00m [00m videosink gstvideosink.c:117:void gst_video_sink_center_rect(GstVideoRectangle, GstVideoRectangle, GstVideoRectangle *, gboolean):[00m source is 320x240 dest is 320x240, result is 320x240 with x,y 0x0
X Error of failed request: BadShmSeg (invalid shared segment parameter)
Major opcode of failed request: 132 (MIT-SHM)
Minor opcode of failed request: 3 (X_ShmPutImage)
Segment id in failed request: 0x600003
Serial number of failed request: 41
Current serial number in output stream: 42
Program ended with exit code: 1
———————————————————————————————————————————
Can somebody help me to find out what I'm doing wrong?
Thank you!
Francisco
More information about the gstreamer-devel
mailing list