nvencoder: Fix CQP option setting
authorSeungha Yang <seungha@centricular.com>
Fri, 17 Mar 2023 16:33:20 +0000 (01:33 +0900)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sat, 18 Mar 2023 05:14:47 +0000 (05:14 +0000)
... and zero initialize LUID and CUDA device list to address
coverity issue

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4217>

subprojects/gst-plugins-bad/sys/nvcodec/gstnvh264encoder.cpp
subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265encoder.cpp

index 2a03e61..9cac64e 100644 (file)
@@ -1280,7 +1280,7 @@ gst_nv_h264_encoder_set_format (GstNvEncoder * encoder,
       rc_params->constQP.qpIntra = self->qp_i;
     if (self->qp_p >= 0)
       rc_params->constQP.qpInterP = self->qp_p;
-    if (self->qp_p >= 0)
+    if (self->qp_b >= 0)
       rc_params->constQP.qpInterB = self->qp_b;
   }
 
@@ -2107,9 +2107,9 @@ gst_nv_h264_encoder_register_auto_select (GstPlugin * plugin,
   std::string resolution_str;
   GList *iter;
   guint adapter_luid_size = 0;
-  gint64 adapter_luid_list[8];
+  gint64 adapter_luid_list[8] = { 0, };
   guint cuda_device_id_size = 0;
-  guint cuda_device_id_list[8];
+  guint cuda_device_id_list[8] = { 0, };
   GstNvEncoderDeviceCaps dev_caps;
   GstNvEncoderClassData *cdata;
   GstCaps *sink_caps = nullptr;
index 076c407..9c77696 100644 (file)
@@ -1255,7 +1255,7 @@ gst_nv_h265_encoder_set_format (GstNvEncoder * encoder,
       rc_params->constQP.qpIntra = self->qp_i;
     if (self->qp_p >= 0)
       rc_params->constQP.qpInterP = self->qp_p;
-    if (self->qp_p >= 0)
+    if (self->qp_b >= 0)
       rc_params->constQP.qpInterB = self->qp_b;
   }
 
@@ -2118,9 +2118,9 @@ gst_nv_h265_encoder_register_auto_select (GstPlugin * plugin,
   std::string resolution_str;
   GList *iter;
   guint adapter_luid_size = 0;
-  gint64 adapter_luid_list[8];
+  gint64 adapter_luid_list[8] = { 0, };
   guint cuda_device_id_size = 0;
-  guint cuda_device_id_list[8];
+  guint cuda_device_id_list[8] = { 0, };
   GstNvEncoderDeviceCaps dev_caps;
   GstNvEncoderClassData *cdata;
   GstCaps *sink_caps = nullptr;