cudaloader: Initialize logging category

gstcudaloader.cpp defines GST_DEBUG_CATEGORY (gst_cudaloader_debug);
but it wasn't initializing it anywhere.

This caused the following error to be logged by gst-plugin-scanner when
libcuda.so.1/nvcuda.dll couldn't be loaded, e.g. in systems without
CUDA:

(gst-plugin-scanner:39618): GStreamer-CRITICAL **: 14:40:22.346:
gst_debug_log_full_valist: assertion 'category != NULL' failed

This patch fixes the bug by initializing the category in
gst_cuda_load_library_once_func() before any logging occurs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4154>
This commit is contained in:
Alicia Boya García 2023-03-10 22:21:42 +01:00 committed by GStreamer Marge Bot
parent 136b2e0eae
commit 85b6625150

View file

@ -146,6 +146,9 @@ gst_cuda_load_library_once_func (void)
const gchar *filename = CUDA_LIBNAME; const gchar *filename = CUDA_LIBNAME;
GstNvCodecCudaVTable *vtable; GstNvCodecCudaVTable *vtable;
GST_DEBUG_CATEGORY_INIT (gst_cudaloader_debug, "cudaloader", 0,
"CUDA plugin loader");
module = g_module_open (filename, G_MODULE_BIND_LAZY); module = g_module_open (filename, G_MODULE_BIND_LAZY);
if (module == nullptr) { if (module == nullptr) {
GST_WARNING ("Could not open library %s, %s", filename, g_module_error ()); GST_WARNING ("Could not open library %s, %s", filename, g_module_error ());