MJPEG patch makes jpegdec segfault

On applying the MJPEG patch for nvjpeg on Nano I’m encoutering a similar error as @jaiforfriend despite using the latest L4T version and purging the GStreamer registry cache:

My output:

coudy@nanog:~$ GST_DEBUG=4 gst-inspect-1.0 jpegdec
0:00:00.000394490 29056   0x55c8f8c200 INFO                GST_INIT gst.c:586:init_pre: Initializing GStreamer Core Library version 1.14.5
0:00:00.000530535 29056   0x55c8f8c200 INFO                GST_INIT gst.c:587:init_pre: Using library installed in /usr/lib/aarch64-linux-gnu
0:00:00.000570692 29056   0x55c8f8c200 INFO                GST_INIT gst.c:607:init_pre: Linux nanog 4.9.140-tegra #1 SMP PREEMPT Mon Dec 9 22:47:42 PST 2019 aarch64
0:00:00.001219251 29056   0x55c8f8c200 INFO                GST_INIT gstmessage.c:127:_priv_gst_message_initialize: init messages
0:00:00.003004349 29056   0x55c8f8c200 INFO                GST_INIT gstcontext.c:84:_priv_gst_context_initialize: init contexts
0:00:00.003958957 29056   0x55c8f8c200 INFO      GST_PLUGIN_LOADING gstplugin.c:317:_priv_gst_plugin_initialize: registering 0 static plugins
0:00:00.004376155 29056   0x55c8f8c200 INFO      GST_PLUGIN_LOADING gstplugin.c:225:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.004429177 29056   0x55c8f8c200 INFO      GST_PLUGIN_LOADING gstplugin.c:227:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.004468501 29056   0x55c8f8c200 INFO            GST_REGISTRY gstregistry.c:1727:ensure_current_registry: reading registry cache: /home/coudy/.cache/gstreamer-1.0/registry.aarch64.bin
0:00:00.045057987 29056   0x55c8f8c200 INFO            GST_REGISTRY gstregistrybinary.c:621:priv_gst_registry_binary_read_cache: loaded /home/coudy/.cache/gstreamer-1.0/registry.aarch64.bin in 0.040536 seconds
0:00:00.045213877 29056   0x55c8f8c200 INFO            GST_REGISTRY gstregistry.c:1583:scan_and_update_registry: Validating plugins from registry cache: /home/coudy/.cache/gstreamer-1.0/registry.aarch64.bin
0:00:00.050631673 29056   0x55c8f8c200 INFO            GST_REGISTRY gstregistry.c:1685:scan_and_update_registry: Registry cache has not changed
0:00:00.050669382 29056   0x55c8f8c200 INFO            GST_REGISTRY gstregistry.c:1762:ensure_current_registry: registry reading and updating done, result = 1
0:00:00.050687508 29056   0x55c8f8c200 INFO                GST_INIT gst.c:807:init_post: GLib runtime version: 2.56.4
0:00:00.050704852 29056   0x55c8f8c200 INFO                GST_INIT gst.c:809:init_post: GLib headers version: 2.56.4
0:00:00.050726779 29056   0x55c8f8c200 INFO                GST_INIT gst.c:810:init_post: initialized GStreamer successfully
0:00:00.086353377 29056   0x55c8f8c200 INFO      GST_PLUGIN_LOADING gstplugin.c:901:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstjpeg.so" loaded
0:00:00.086409420 29056   0x55c8f8c200 INFO     GST_ELEMENT_FACTORY gstelementfactory.c:361:gst_element_factory_create: creating element "jpegdec"
0:00:00.086748179 29056   0x55c8f8c200 INFO        GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstVideoDecoder@0x55c9211d00> adding pad 'sink'
0:00:00.086806409 29056   0x55c8f8c200 INFO        GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstVideoDecoder@0x55c9211d00> adding pad 'src'
Segmentation fault (core dumped)
coudy@nanog:~$ ll ~/gstjpeg_src/gst-jpeg/gst-jpeg-1.0/ext/jpeg/.libs/libgstjpeg.so
-rwxrwxr-x 1 coudy coudy 182480 Apr  8 00:17 /home/coudy/gstjpeg_src/gst-jpeg/gst-jpeg-1.0/ext/jpeg/.libs/libgstjpeg.so*
coudy@nanog:~$ ll /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvjpeg.so
-rw-r--r-- 1 root root 182480 Apr 15 08:13 /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvjpeg.so
coudy@nanog:~$ ll /usr/lib/aarch64-linux-gnu/libjpeg.so*
lrwxrwxrwx 1 root root     18 Apr 15 08:15 /usr/lib/aarch64-linux-gnu/libjpeg.so -> tegra/libnvjpeg.so
lrwxrwxrwx 1 root root     18 Apr 15 08:15 /usr/lib/aarch64-linux-gnu/libjpeg.so.8 -> tegra/libnvjpeg.so
-rw-r--r-- 1 root root 236168 Nov 12 14:09 /usr/lib/aarch64-linux-gnu/libjpeg.so.8.1.2

Also, I’ve noticed the last step’s comment is inconsistent with the actual command:

9) Link libgstjpeg.so to Nvidia libnvjpeg.so
        sudo ln -sf tegra/libnvjpeg.so libjpeg.so
        sudo ln -sf tegra/libnvjpeg.so libjpeg.so.8

I’m following the command, not the comment. Is this correct? Manually re-linking global libjpeg maintained by Ubuntu doesn’t sound right.

Can anyone reproduce this?

Hi,
Please apply

7) sudo cp -i ext/jpeg/.libs/libgstjpeg.so /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvjpeg.so

And not to apply

        sudo ln -sf tegra/libnvjpeg.so libjpeg.so
        sudo ln -sf tegra/libnvjpeg.so libjpeg.so.8