nvenc: Give more details about errors
authorThibault Saunier <tsaunier@igalia.com>
Fri, 3 Dec 2021 13:12:42 +0000 (13:12 +0000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 19 Apr 2022 16:39:43 +0000 (16:39 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1472>

subprojects/gst-plugins-bad/sys/nvcodec/gstnvbaseenc.c
subprojects/gst-plugins-bad/sys/nvcodec/gstnvenc.c

index f42f25c..b57ba23 100644 (file)
@@ -1847,7 +1847,8 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state)
 
   if (nv_ret != NV_ENC_SUCCESS) {
     GST_ELEMENT_ERROR (nvenc, LIBRARY, SETTINGS, (NULL),
-        ("Failed to %sinit encoder: %d", reconfigure ? "re" : "", nv_ret));
+        ("Failed to %sinit encoder: %d- %s", reconfigure ? "re" : "", nv_ret,
+            NvEncGetLastErrorString (nvenc->encoder)));
     NvEncDestroyEncoder (nvenc->encoder);
     nvenc->encoder = NULL;
     return FALSE;
index 7cbd10f..a3e1a42 100644 (file)
@@ -79,6 +79,13 @@ NvEncDestroyEncoder (void *encoder)
   return nvenc_api.nvEncDestroyEncoder (encoder);
 }
 
+const char *NVENCAPI
+NvEncGetLastErrorString (void *encoder)
+{
+  g_assert (nvenc_api.nvEncGetLastErrorString != NULL);
+  return nvenc_api.nvEncGetLastErrorString (encoder);
+}
+
 NVENCSTATUS NVENCAPI
 NvEncGetEncodeGUIDs (void *encoder, GUID * array, uint32_t array_size,
     uint32_t * count)