From fed252cabd29d0a07a212f6743432b893f6df227 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 18 Mar 2023 01:33:20 +0900 Subject: [PATCH] nvencoder: Fix CQP option setting ... and zero initialize LUID and CUDA device list to address coverity issue Part-of: --- .../gst-plugins-bad/sys/nvcodec/gstnvh264encoder.cpp | 6 +++--- .../gst-plugins-bad/sys/nvcodec/gstnvh265encoder.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh264encoder.cpp b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh264encoder.cpp index a54793cf01..4c159ecaf9 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh264encoder.cpp +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh264encoder.cpp @@ -1301,7 +1301,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; } @@ -2219,9 +2219,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; diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265encoder.cpp b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265encoder.cpp index db39c85022..c2b47d2a60 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265encoder.cpp +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265encoder.cpp @@ -1276,7 +1276,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; } @@ -2236,9 +2236,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;