From 3549d59725460e6608aebf5b1b143f76285eaeb5 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 3 Dec 2021 13:12:42 +0000 Subject: [PATCH] nvenc: Give more details about errors Part-of: --- subprojects/gst-plugins-bad/sys/nvcodec/gstnvbaseenc.c | 3 ++- subprojects/gst-plugins-bad/sys/nvcodec/gstnvenc.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvbaseenc.c b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvbaseenc.c index f42f25c48a..b57ba23b99 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvbaseenc.c +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvbaseenc.c @@ -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; diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvenc.c b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvenc.c index 7cbd10f50d..a3e1a427cd 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvenc.c +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvenc.c @@ -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) -- 2.34.1