vkdecoder: init debug category earlier

The decoder has not been created if the codec is not supported by
the hardware, so the GST_WARNING_OBJECT will fail to find a suitable
category.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8138>
This commit is contained in:
Stéphane Cerveau 2024-12-12 14:40:55 +01:00 committed by GStreamer Marge Bot
parent f4733d0af7
commit f618270c59

View file

@ -66,9 +66,7 @@ GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
#define gst_vulkan_decoder_parent_class parent_class #define gst_vulkan_decoder_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVulkanDecoder, gst_vulkan_decoder, G_DEFINE_TYPE_WITH_CODE (GstVulkanDecoder, gst_vulkan_decoder,
GST_TYPE_OBJECT, G_ADD_PRIVATE (GstVulkanDecoder) GST_TYPE_OBJECT, G_ADD_PRIVATE (GstVulkanDecoder));
GST_DEBUG_CATEGORY_INIT (gst_vulkan_decoder_debug,
"vulkandecoder", 0, "Vulkan device decoder"));
static GstVulkanHandle *gst_vulkan_decoder_new_video_session_parameters static GstVulkanHandle *gst_vulkan_decoder_new_video_session_parameters
(GstVulkanDecoder * self, GstVulkanDecoderParameters * params, (GstVulkanDecoder * self, GstVulkanDecoderParameters * params,
@ -1301,6 +1299,7 @@ gst_vulkan_decoder_new_from_queue (GstVulkanQueue * queue, guint codec)
GstVulkanDecoder *decoder; GstVulkanDecoder *decoder;
guint flags, expected_flag, supported_video_ops; guint flags, expected_flag, supported_video_ops;
const char *extension; const char *extension;
static gsize cat_gonce = 0;
g_return_val_if_fail (GST_IS_VULKAN_QUEUE (queue), NULL); g_return_val_if_fail (GST_IS_VULKAN_QUEUE (queue), NULL);
@ -1309,6 +1308,12 @@ gst_vulkan_decoder_new_from_queue (GstVulkanQueue * queue, guint codec)
flags = device->queue_family_props[queue->family].queueFlags; flags = device->queue_family_props[queue->family].queueFlags;
supported_video_ops = device->queue_family_ops[queue->family].video; supported_video_ops = device->queue_family_ops[queue->family].video;
if (g_once_init_enter (&cat_gonce)) {
GST_DEBUG_CATEGORY_INIT (gst_vulkan_decoder_debug,
"vulkandecoder", 0, "Vulkan device decoder");
g_once_init_leave (&cat_gonce, TRUE);
}
if (device->properties.apiVersion < VK_MAKE_VERSION (1, 3, 275)) { if (device->properties.apiVersion < VK_MAKE_VERSION (1, 3, 275)) {
GST_WARNING_OBJECT (queue, GST_WARNING_OBJECT (queue,
"Driver API version [%d.%d.%d] doesn't support Video extensions", "Driver API version [%d.%d.%d] doesn't support Video extensions",