JetPack5.1.1 does not support H265 GDR decoding

Hi,
Please apply the patch to gst-v4l2 and rebuild/replace libgstnvvideo4linux2.so:

diff --git a/gst-v4l2/gstv4l2videodec.c b/gst-v4l2/gstv4l2videodec.c
index cb2ed29..e88f8ef 100644
--- a/gst-v4l2/gstv4l2videodec.c
+++ b/gst-v4l2/gstv4l2videodec.c
@@ -241,6 +241,7 @@ enum
   PROP_ENABLE_ERROR_CHECK,
   PROP_ENABLE_MAX_PERFORMANCE,
   PROP_OPEN_MJPEG_BLOCK,
+  PROP_IS_GDR_STREAM,
 /*Properties exposed on dGPU only*/
   PROP_CUDADEC_MEM_TYPE,
   PROP_CUDADEC_GPU_ID,
@@ -391,6 +392,11 @@ gst_v4l2_video_dec_set_property_tegra (GObject * object,
       self->v4l2output->open_mjpeg_block = g_value_get_boolean (value);
       break;
 
+    case PROP_IS_GDR_STREAM:
+      self->is_gdr_stream = g_value_get_boolean (value);
+      self->enable_frame_type_reporting = g_value_get_boolean (value);
+      break;
+
     case PROP_CAP_BUF_DYNAMIC_ALLOCATION:
       self->cap_buf_dynamic_allocation = g_value_get_enum (value);
       break;
@@ -518,6 +524,10 @@ gst_v4l2_video_dec_get_property_tegra (GObject * object,
       g_value_set_boolean (value, self->v4l2output->open_mjpeg_block);
       break;
 
+    case PROP_IS_GDR_STREAM:
+      g_value_set_boolean (value, self->is_gdr_stream);
+      break;
+
     case PROP_CAP_BUF_DYNAMIC_ALLOCATION:
       g_value_set_enum (value, self->cap_buf_dynamic_allocation);
       break;
@@ -1418,8 +1428,9 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
    * a frame. In case of RTSP inputs we drop the DELTA units which are not
    * decodable independently until we receive I / IDR frame.
   */
-  if ((GST_V4L2_PIXELFORMAT(obj) == V4L2_PIX_FMT_H264) ||
-          (GST_V4L2_PIXELFORMAT(obj) == V4L2_PIX_FMT_H265))
+  if (((GST_V4L2_PIXELFORMAT(obj) == V4L2_PIX_FMT_H264) ||
+          (GST_V4L2_PIXELFORMAT(obj) == V4L2_PIX_FMT_H265)) &&
+          self->is_gdr_stream == FALSE)
   {
       if ((GST_BUFFER_FLAG_IS_SET (GST_BUFFER_CAST(frame->input_buffer),
                                   GST_BUFFER_FLAG_DELTA_UNIT)) &&
@@ -2240,6 +2251,12 @@ gst_v4l2_video_dec_class_init (GstV4l2VideoDecClass * klass)
             "Enable max performance", "Set to enable max performance",
             DEFAULT_MAX_PERFORMANCE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+    g_object_class_install_property (gobject_class, PROP_IS_GDR_STREAM,
+        g_param_spec_boolean ("is-gdr-stream",
+            "is-gdr-stream",
+            "Whether or not the H264/H265 stream is GDR stream",
+            FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
     g_object_class_install_property (gobject_class, PROP_CAP_BUF_DYNAMIC_ALLOCATION,
       g_param_spec_enum ("capture-buffer-dynamic-allocation",
           "Enable capture buffer dynamic allocation",
diff --git a/gst-v4l2/gstv4l2videodec.h b/gst-v4l2/gstv4l2videodec.h
index 97cc58a..d50e47a 100644
--- a/gst-v4l2/gstv4l2videodec.h
+++ b/gst-v4l2/gstv4l2videodec.h
@@ -86,6 +86,7 @@ struct _GstV4l2VideoDec
   gboolean enable_frame_type_reporting;
   gboolean enable_error_check;
   gboolean enable_max_performance;
+  gboolean is_gdr_stream;
   guint32 cudadec_mem_type;
   guint32 cudadec_gpu_id;
   guint32 cudadec_num_surfaces;

It add a property is-gdr-stream. Please set the property while decoding H264/H265 GDR streams.

The source code of gst-v4l2 is in
https://developer.nvidia.com/embedded/jetson-linux-r3531

Driver Package (BSP) Sources

1 Like