jpegdec generates Segmentation fault (core dumped) while avdec_mjpeg runs succesfully
Setup
- Ubuntu
- Computer
- 1.21.1.1 / Head
Steps to reproduce the bug
Statically build Gstreamer with jpeg
How reproducible is the bug?
Always
Description
For some time, we have been using avdec_mjpeg
because, for us, it has proven more stable than jpegdec
. Still, we would prefer be able to make use of jpegdec
as well.
In our application, we select one out of several pipelines based on use input. One example is the following:
char format_souphttpsrc_string[] = "souphttpsrc is-live=true name=mainsource location=http://192.168.1.180/video1s3.mjpg ! jpegparse ! avdec_mjpeg ! jpegdecvideoconvertscale ! video/x-raw,format=RGB,width=[1,640],height=[1,640],pixel-aspect-ratio=1/1 ! appsink name=sclbl_gst_appsink max-buffers=30 drop=true sync=false"
sclbl_gst_pipeline = gst_parse_launch(souphttpsrc_string, NULL);
This runs as expected.
But when we replace avdec_mjpeg
by jpegdec
...
char format_souphttpsrc_string[] = "souphttpsrc is-live=true name=mainsource location=http://192.168.1.180/video1s3.mjpg ! jpegparse ! jpegdec ! videoconvertscale ! video/x-raw,format=RGB,width=[1,640],height=[1,640],pixel-aspect-ratio=1/1 ! appsink name=sclbl_gst_appsink max-buffers=30 drop=true sync=false"
sclbl_gst_pipeline = gst_parse_launch(souphttpsrc_string, NULL);
...the pipeline will generate Segmentation fault (core dumped)
right away for gst_parse_launch
:
0:00:00.191733429 253975 0x7f2ccacf0c00 LOG GST_ELEMENT_FACTORY gstelementfactory.c:682:gst_element_factory_make_with_properties: gstelementfactory: make "jpegdec"
0:00:00.191739560 253975 0x7f2ccacf0c00 LOG GST_ELEMENT_FACTORY gstelementfactory.c:688:gst_element_factory_make_with_properties:<jpegdec> found factory 0x7f2ccacbfae0
0:00:00.191745091 253975 0x7f2ccacf0c00 DEBUG GST_PLUGIN_LOADING gstpluginfeature.c:106:gst_plugin_feature_load: loading plugin for feature 0x7f2ccacbfae0; 'jpegdec'
0:00:00.191750150 253975 0x7f2ccacf0c00 INFO GST_ELEMENT_FACTORY gstelementfactory.c:489:gst_element_factory_create_with_properties: creating element "jpegdec"
0:00:00.191758346 253975 0x7f2ccacf0c00 DEBUG videodecoder gstvideodecoder.c:728:gst_video_decoder_init:<GstVideoDecoder@0x7f2cc98c0ba0> gst_video_decoder_init
0:00:00.191768725 253975 0x7f2ccacf0c00 DEBUG GST_PADS gstpad.c:1803:gst_pad_set_chain_function_full:<'':sink> chainfunc set to gst_video_decoder_chain
0:00:00.191774857 253975 0x7f2ccacf0c00 DEBUG GST_PADS gstpad.c:1909:gst_pad_set_event_function_full:<'':sink> eventfunc for set to gst_video_decoder_sink_event
0:00:00.191780878 253975 0x7f2ccacf0c00 DEBUG GST_PADS gstpad.c:1989:gst_pad_set_query_function_full:<'':sink> queryfunc set to gst_video_decoder_sink_query
0:00:00.191786639 253975 0x7f2ccacf0c00 INFO GST_ELEMENT_PADS gstelement.c:757:gst_element_add_pad:<GstVideoDecoder@0x7f2cc98c0ba0> adding pad 'sink'
0:00:00.191792009 253975 0x7f2ccacf0c00 DEBUG GST_REFCOUNTING gstobject.c:708:gst_object_set_parent:<'':sink> set parent (ref and sink)
0:00:00.191799263 253975 0x7f2ccacf0c00 DEBUG GST_PADS gstpad.c:1909:gst_pad_set_event_function_full:<'':src> eventfunc for set to gst_video_decoder_src_event
0:00:00.191805064 253975 0x7f2ccacf0c00 DEBUG GST_PADS gstpad.c:1989:gst_pad_set_query_function_full:<'':src> queryfunc set to gst_video_decoder_src_query
0:00:00.191810855 253975 0x7f2ccacf0c00 INFO GST_ELEMENT_PADS gstelement.c:757:gst_element_add_pad:<GstVideoDecoder@0x7f2cc98c0ba0> adding pad 'src'
0:00:00.191816034 253975 0x7f2ccacf0c00 DEBUG GST_REFCOUNTING gstobject.c:708:gst_object_set_parent:<'':src> set parent (ref and sink)
0:00:00.191824180 253975 0x7f2ccacf0c00 DEBUG videodecoder gstvideodecoder.c:2312:gst_video_decoder_reset:<GstVideoDecoder@0x7f2cc98c0ba0> reset full 1
0:00:00.191829630 253975 0x7f2ccacf0c00 DEBUG jpegdec gstjpegdec.c:258:gst_jpeg_dec_init: initializing
Segmentation fault (core dumped)
This can be traced more specifically to line 268 of gstjpegdec.c
in function gst_jpeg_dec_init()
:
jpeg_create_decompress (&dec->cinfo);
Maybe there's some additional initialization we need to do for jpegdec
that is not necessary (or caught on a first try) for avdec_mjpeg
?