nvjpegdec misbehaving (memory leak?)

I would like to report misbehavior of ‘nvjpegdec’.

Running the following on my Jetson Nano (developer kit):

gst-launch-1.0 videotestsrc ! videoconvert ! nvjpegenc ! ‘image/jpeg,width=800, height=600’ ! videorate ! ‘image/jpeg, framerate=20/1’ ! nvjpegdec ! autovideosink

fails after ~50 seconds (I timed it a few times, its rather consistent) with error:
NvRmChannelSubmit: NvError_IoctlFailed with error code 22
NvRmPrivFlush: NvRmChannelSubmit failed (err = 196623, SyncPointIdx = 23, SyncPointValue = 0)

For higher resolutions it fails quicker - e.g. with 1920 x 1080 used in the above, it took ~25s.

Having read that the error code deals with HW blocks not accepting requests, I replaced the (encoder and) decoder with software-based, i.e. ‘jpegdec’ instead of ‘nvjpegdec’ and it fixed the problem (or at least it didn’t crush during the time that I had the patience to wait, i.e. some 5 minutes).
So - this works:

gst-launch-1.0 videotestsrc ! videoconvert ! jpegenc ! ‘image/jpeg,width=800, height=600’ ! videorate ! ‘image/jpeg, framerate=20/1’ ! jpegdec ! autovideosink

also, I tried using the hw encoder:

gst-launch-1.0 videotestsrc ! videoconvert ! nvjpegenc ! ‘image/jpeg,width=800, height=600’ ! videorate ! ‘image/jpeg, framerate=20/1’ ! jpegdec ! autovideosink

and it also works (at least for the test’s duration of 5 mins).

Only with ‘nvjpegdec’ it crashes, so all fingers point to nvjpegdec and the behavior, to my mind, might indicate a memory leak.

Hi,
We have patch for the issue. Please check https://elinux.org/L4T_Jetson/r32.2.1_patch

thank you very much for timely and accurate reply

Hi @DaneLLL,

Does the updated “libnvjpeg.so” incorporate the patch to allow nvjpegdec to decode motion jpegs using [nvjpegdec ! ‘video/x-raw(memory:NVMM)’]?
https://devtalk.nvidia.com/default/topic/1049311/jetson-agx-xavier/nvjpegdec-slower-then-jpegdec-in-gstreamer/post/5348034/#5348034

My fundamental intent is to stream motion jpeg from a webcam (e-con See3CAM_CU135) using as much hardware acceleration as possible. My intended pipeline is as follows

gst-launch-1.0 -vv v4l2src device=/dev/video0 io-mode=2 ! "image/jpeg, width=3840, height=2160, framerate=5/1" ! nvjpegdec ! "video/x-raw(memory:NVMM), format=I420" ! nvoverlaysink

However I get the following error

NvxBaseWorkerFunction[2575] comp OMX.Nvidia.std.iv_renderer.overlay.yuv420 Error -2147479552

Hi benky58un,
No, the patch is in libgstnvjpeg.so.

gst-jpeg is open source https://developer.nvidia.com/embedded/dlc/r32-2-1_Release_v1.0/TX2-AGX/sources/public_sources.tbz2
You may download the source code to apply the patch and rebuild it.

Ah my mistake @DaneLLL I didn’t notice that they were two separate libraries.