g_object_set and thread safetry

Guy Morand g.morand at scewo.ch
Fri Oct 2 11:09:06 UTC 2020


Hallo gstreamers developers,

I'm writing a small daemon to stream the camera and send the stream
over RTP. The user can configure the stream and mirror the image. To
do that, while the stream is running, I make a call from the main
thread similar to:

g_object_set(_video_flip, "video-direction", GST_VIDEO_FLIP_HORIZONTAL, NULL);

Where _video_flip is a GstElement* built with
gst_element_factory_make("videoflip", "videoflip")

Sometime, the stream stops and the application "crashes" with the message:
ERROR:gstvideoflip.c:954:gst_video_flip_y422: code should not be reached

Back trace with gdb gives me this relevant gstreamer stack trace:
__GI_raise (sig=sig at entry=0x6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
gdb$ bt
#0  0x00007ffff6d597bb in __GI_raise (sig=sig at entry=0x6) at
../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff6d44535 in __GI_abort () at abort.c:79
#2  0x00007ffff7480dc3 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff74da67a in g_assertion_message_expr () at
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007ffff4c4f5ef in gst_video_flip_y422 (videoflip=<optimized
out>, dest=<optimized out>, src=<optimized out>) at gstvideoflip.c:954
#5  0x00007ffff4c4d893 in gst_video_flip_transform_frame
(vfilter=0x555555858790, in_frame=0x7ffff1470530,
out_frame=0x7ffff14707d0) at gstvideoflip.c:1139
#6  0x00007ffff4ba9e03 in  () at /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0
#7  0x00007ffff4b3c609 in default_generate_output
(trans=0x555555858790, outbuf=0x7ffff1470ae0) at
gstbasetransform.c:2132
#8  0x00007ffff4b3bcd6 in gst_base_transform_chain (pad=<optimized
out>, parent=0x555555858790, buffer=<optimized out>) at
gstbasetransform.c:2285
#9  0x00007ffff7651c3a in gst_pad_chain_data_unchecked
(data=0x7fffd401b190, type=4112, pad=0x555555852780) at gstpad.c:4322
#10 0x00007ffff7651c3a in gst_pad_push_data
(pad=pad at entry=0x555555853560, type=type at entry=4112,
data=data at entry=0x7fffd401b190) at gstpad.c:4578
#11 0x00007ffff7659ed2 in gst_pad_push (pad=0x555555853560,
buffer=0x7fffd401b190) at gstpad.c:4697
#12 0x00007ffff4b3bdfd in gst_base_transform_chain (pad=<optimized
out>, parent=0x5555558602c0, buffer=<optimized out>) at
gstbasetransform.c:2321
#13 0x00007ffff7651c3a in gst_pad_chain_data_unchecked
(data=0x7fffd401b190, type=4112, pad=0x555555853310) at gstpad.c:4322
#14 0x00007ffff7651c3a in gst_pad_push_data
(pad=pad at entry=0x555555852090, type=type at entry=4112,
data=data at entry=0x7fffd401b190) at gstpad.c:4578
#15 0x00007ffff7659ed2 in gst_pad_push (pad=pad at entry=0x555555852090,
buffer=0x7fffd401b190) at gstpad.c:4697
#16 0x00007ffff4b37ce5 in gst_base_src_loop (pad=0x555555852090) at
gstbasesrc.c:2957
#17 0x00007ffff7686f41 in gst_task_func (task=0x55555588c290) at gsttask.c:332
#18 0x00007ffff74dbdb3 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007ffff74db415 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007ffff720dfa3 in start_thread (arg=<optimized out>) at
pthread_create.c:486
#21 0x00007ffff6e1b4cf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

I'm wondering if that is a thread safety issue and if I'm allowed to
do it this way. Any pointer?

Best regards,

Guy Morand


More information about the gstreamer-devel mailing list