mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
nvcodec: Log readable errors when initializing CUDA
It is really difficult for people to figure out why nvcodec has 0 features. Even the debug log is cryptic. Also make sure the errors go to the ERROR log level, which is more likely to be enabled by default. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3813>
This commit is contained in:
parent
5ab15e1738
commit
1eae03486e
1 changed files with 12 additions and 4 deletions
|
@ -65,6 +65,7 @@ static gboolean
|
|||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
CUresult cuda_ret;
|
||||
const char *err_name = NULL, *err_desc = NULL;
|
||||
gint dev_count = 0;
|
||||
guint i;
|
||||
gboolean nvdec_available = TRUE;
|
||||
|
@ -102,7 +103,8 @@ plugin_init (GstPlugin * plugin)
|
|||
}
|
||||
|
||||
if (!gst_cuvid_load_library (api_major_ver, api_minor_ver)) {
|
||||
GST_WARNING ("Failed to load nvdec library");
|
||||
GST_WARNING ("Failed to load nvdec library version %u.%u", api_major_ver,
|
||||
api_minor_ver);
|
||||
nvdec_available = FALSE;
|
||||
}
|
||||
|
||||
|
@ -111,13 +113,19 @@ plugin_init (GstPlugin * plugin)
|
|||
|
||||
cuda_ret = CuInit (0);
|
||||
if (cuda_ret != CUDA_SUCCESS) {
|
||||
GST_WARNING ("Failed to init cuda, ret: 0x%x", (gint) cuda_ret);
|
||||
CuGetErrorName (cuda_ret, &err_name);
|
||||
CuGetErrorString (cuda_ret, &err_desc);
|
||||
GST_ERROR ("Failed to init cuda, cuInit ret: 0x%x: %s: %s",
|
||||
(int) cuda_ret, err_name, err_desc);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
cuda_ret = CuDeviceGetCount (&dev_count);
|
||||
if (cuda_ret != CUDA_SUCCESS || !dev_count) {
|
||||
GST_WARNING ("No available device, ret: 0x%x", (gint) cuda_ret);
|
||||
CuGetErrorName (cuda_ret, &err_name);
|
||||
CuGetErrorString (cuda_ret, &err_desc);
|
||||
GST_ERROR ("No available device, cuDeviceGetCount ret: 0x%x: %s %s",
|
||||
(int) cuda_ret, err_name, err_desc);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -153,7 +161,7 @@ plugin_init (GstPlugin * plugin)
|
|||
CUcontext cuda_ctx;
|
||||
|
||||
if (!context) {
|
||||
GST_WARNING ("Failed to create context for deevice %d", i);
|
||||
GST_WARNING ("Failed to create context for device %d", i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue