Nvv4l2decoder hangs when h264 stream changes framerate

• Hardware Platform (Jetson / GPU): GPU
• DeepStream Version: 6.1
• JetPack Version (valid for Jetson only): n/a
• TensorRT Version: 8.4.0.6
• NVIDIA GPU Driver Version (valid for GPU only): 515.86.01
• Issue Type( questions, new requirements, bugs): Bug
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing):

Create any pipeline containing a h264 stream to a nvv4l2decoder pipeline. We are seeing an issue if the SPS/PPS advertises a new framerate, the nvidia decoder just hangs. We see this issues on cameras that change their framerate dynamically based on scheduled settings.

Could you attach how to set the scheduled settings for your camera to change video framerate dynamically?

I’m not 100% sure about the specs of the recording system as they are at a client site, but as I understand it:’

The recording schedule is set to “Event”

Then in the settings the “Main Stream (Normal)” is set to 8fps

and the Main Stream (Event) is set to 15fps:

Here are the logs at GST_DEBUG=6 around the time we see the decoder fail:

Mar 28 11:17:35: 0:02:06.221702489 46044 0x7fd938869aa0 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:958:gst_v4l2_buffer_pool_streamoff:<nvv4l2decoder0:pool:sink> Stopped streaming
Mar 28 11:17:35: 0:02:06.221757281 46044 0x7fd938869aa0 DEBUG         v4l2bufferpool gstv4l2bufferpool.c:1685:gst_v4l2_buffer_pool_release_buffer:<nvv4l2decoder0:pool:sink> release buffer 0x7fd85b667a20
Mar 28 11:17:35: 0:02:06.221782750 46044 0x7fd938869aa0 LOG           v4l2bufferpool gstv4l2bufferpool.c:1760:gst_v4l2_buffer_pool_release_buffer:<nvv4l2decoder0:pool:sink> buffer 1 not queued, putting on free list
Mar 28 11:17:35: 0:02:06.221800829 46044 0x7fd938869aa0 LOG               bufferpool gstbufferpool.c:1285:default_release_buffer:<nvv4l2decoder0:pool:sink> released buffer 0x7fd85b667a20 0
Mar 28 11:17:35: 0:02:06.221851964 46044 0x7fd938869aa0 LOG               GST_BUFFER gstbuffer.c:768:_gst_buffer_free: finalize 0x7fd85b667c60
Mar 28 11:17:35: 0:02:06.221868440 46044 0x7fd938869aa0 LOG            v4l2allocator gstv4l2allocator.c:386:gst_v4l2_allocator_release:<nvv4l2decoder0:pool:sink:allocator> plane 0 of buffer 0 released
Mar 28 11:17:35: 0:02:06.221882438 46044 0x7fd938869aa0 LOG            v4l2allocator gstv4l2allocator.c:405:gst_v4l2_allocator_release:<nvv4l2decoder0:pool:sink:allocator> buffer 0 released
Mar 28 11:17:35: 0:02:06.221899360 46044 0x7fd938869aa0 LOG               bufferpool gstbufferpool.c:382:do_free_buffer:<nvv4l2decoder0:pool:sink> freeing buffer 0x7fd85b667a20 (0 left)
Mar 28 11:17:35: 0:02:06.221909209 46044 0x7fd938869aa0 LOG               GST_BUFFER gstbuffer.c:768:_gst_buffer_free: finalize 0x7fd85b667a20
Mar 28 11:17:35: 0:02:06.221921717 46044 0x7fd938869aa0 LOG            v4l2allocator gstv4l2allocator.c:386:gst_v4l2_allocator_release:<nvv4l2decoder0:pool:sink:allocator> plane 0 of buffer 1 released
Mar 28 11:17:35: 0:02:06.221931920 46044 0x7fd938869aa0 LOG            v4l2allocator gstv4l2allocator.c:405:gst_v4l2_allocator_release:<nvv4l2decoder0:pool:sink:allocator> buffer 1 released
Mar 28 11:17:35: 0:02:06.221942913 46044 0x7fd938869aa0 DEBUG          v4l2allocator gstv4l2allocator.c:812:gst_v4l2_allocator_stop:<nvv4l2decoder0:pool:sink:allocator> stop allocator
Mar 28 11:17:35: 0:02:06.225845077 46044 0x7fd938869aa0 LOG            v4l2allocator gstv4l2allocator.c:461:gst_v4l2_allocator_dispose:<nvv4l2decoder0:pool:sink:allocator> called
Mar 28 11:17:35: 0:02:06.225868983 46044 0x7fd938869aa0 LOG            v4l2allocator gstv4l2allocator.c:478:gst_v4l2_allocator_finalize:<nvv4l2decoder0:pool:sink:allocator> called
Mar 28 11:17:35: 0:02:06.225887689 46044 0x7fd938869aa0 DEBUG             bufferpool gstbufferpool.c:192:gst_buffer_pool_finalize:<nvv4l2decoder0:pool:sink> 0x7fd78830e0c0 finalize
Mar 28 11:17:35: 0:02:06.225901506 46044 0x7fd938869aa0 LOG               bufferpool gstbufferpool.c:501:gst_buffer_pool_set_active:<nvv4l2decoder0:pool:sink> active 0
Mar 28 11:17:35: 0:02:06.225913563 46044 0x7fd938869aa0 DEBUG             bufferpool gstbufferpool.c:547:gst_buffer_pool_set_active:<nvv4l2decoder0:pool:sink> pool was in the right state
Mar 28 11:17:35: 0:02:06.225925080 46044 0x7fd938869aa0 DEBUG               GST_POLL gstpoll.c:772:gst_poll_free: 0x7fd788004e30: freeing
Mar 28 11:17:35: 0:02:06.226023757 46044 0x7fd938869aa0 DEBUG               GST_CAPS gstpad.c:2732:gst_pad_get_current_caps:<nvv4l2decoder0:src> get current pad caps video/x-raw(memory:NVMM), format=(string)NV12, width=(int)2688, height=(int)1520, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)8/1
Mar 28 11:17:35: 0:02:06.226047707 46044 0x7fd938869aa0 DEBUG                  query gstquery.c:679:gst_query_new_custom: creating new query 0x7fd8b4007f70 allocation
Mar 28 11:17:35: 0:02:06.226063199 46044 0x7fd938869aa0 DEBUG               GST_PADS gstpad.c:4180:gst_pad_peer_query:<nvv4l2decoder0:src> peer query 0x7fd8b4007f70 (allocation)
Mar 28 11:17:35: 0:02:06.226079895 46044 0x7fd938869aa0 DEBUG               GST_PADS gstpad.c:4053:gst_pad_query:<videorate_2N3xfetXmNSO18MOefI6HoPVjCh:sink> doing query 0x7fd8b4007f70 (allocation)
Mar 28 11:17:35: 0:02:06.226097541 46044 0x7fd938869aa0 DEBUG               GST_PADS gstpad.c:3437:gst_pad_query_default:<videorate_2N3xfetXmNSO18MOefI6HoPVjCh:sink> not forwarding 0x7fd8b4007f70 (allocation) query
Mar 28 11:17:35: 0:02:06.226112939 46044 0x7fd938869aa0 DEBUG               GST_PADS gstpad.c:4076:gst_pad_query:<videorate_2N3xfetXmNSO18MOefI6HoPVjCh:sink> sent query 0x7fd8b4007f70 (allocation), result 0
Mar 28 11:17:35: 0:02:06.226124698 46044 0x7fd938869aa0 DEBUG               GST_PADS gstpad.c:4122:gst_pad_query:<videorate_2N3xfetXmNSO18MOefI6HoPVjCh:sink> query failed
Mar 28 11:17:35: 0:02:06.226137210 46044 0x7fd938869aa0 DEBUG               GST_PADS gstpad.c:4243:gst_pad_peer_query:<nvv4l2decoder0:src> query failed
Mar 28 11:17:35: 0:02:06.226149747 46044 0x7fd938869aa0 DEBUG                   v4l2 gstv4l2object.c:4438:gst_v4l2_object_stop:<nvv4l2decoder0:src> stopping
Mar 28 11:17:35: 0:02:06.226161228 46044 0x7fd938869aa0 DEBUG                   v4l2 gstv4l2object.c:4446:gst_v4l2_object_stop:<nvv4l2decoder0:src> deactivating pool
Mar 28 11:17:35: 0:02:06.226171559 46044 0x7fd938869aa0 LOG               bufferpool gstbufferpool.c:501:gst_buffer_pool_set_active:<nvv4l2decoder0:pool:src> active 0
Mar 28 11:17:35: 0:02:06.226182716 46044 0x7fd938869aa0 LOG               bufferpool gstbufferpool.c:533:gst_buffer_pool_set_active:<nvv4l2decoder0:pool:src> outstanding buffers 1
Mar 28 11:17:35: 0:02:06.336696699 46044 0x5593b6547b30 LOG               GST_BUFFER gstbuffer.c:844:gst_buffer_new: new 0x7fd940052b40

Could you help dump the stream from your camera and attach to us?

Hi,

I’ve provided a sample video to you via direct message. With the sample video the following pipeline works:

$ gst-launch-1.0 filesrc location=brc.mp4 ! qtdemux name=demux demux.video_0 ! h264parse ! avdec_h264 ! fakevideosink sync=false
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
Got EOS from element "pipeline0".
Execution ended after 0:00:13.828096633
Setting pipeline to NULL ...
Freeing pipeline ...

whereas with nvv4l2decoder it will hang indefinitely.

$ gst-launch-1.0 filesrc location=brc.mp4 ! qtdemux name=demux demux.video_0 ! h264parse ! nvv4l2decoder ! fakevideosink sync=false
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

I can reproduce the problem with your video. We’ll analyze it and let you know if we have any conclusions.

Any indication if this might have been fixed with Deepstream 6.3?

Yes. You can try that on DeepStream 6.3.