vulkan: fix memory leak at dynamic registering
Also it cleans up a bit the code. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8639>
This commit is contained in:
parent
83ae21e8fe
commit
6cf03e31bc
@ -47,7 +47,6 @@ struct CData
|
|||||||
|
|
||||||
typedef struct _GstVulkanH264Decoder GstVulkanH264Decoder;
|
typedef struct _GstVulkanH264Decoder GstVulkanH264Decoder;
|
||||||
typedef struct _GstVulkanH264DecoderClass GstVulkanH264DecoderClass;
|
typedef struct _GstVulkanH264DecoderClass GstVulkanH264DecoderClass;
|
||||||
typedef struct _GstVulkanH264Decoder GstVulkanH264Decoder;
|
|
||||||
typedef struct _GstVulkanH264Picture GstVulkanH264Picture;
|
typedef struct _GstVulkanH264Picture GstVulkanH264Picture;
|
||||||
typedef struct _SPS SPS;
|
typedef struct _SPS SPS;
|
||||||
typedef struct _PPS PPS;
|
typedef struct _PPS PPS;
|
||||||
@ -1356,11 +1355,9 @@ gst_vulkan_h264_decoder_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
GST_VULKAN_H264_DECODER_CLASS (g_klass);
|
GST_VULKAN_H264_DECODER_CLASS (g_klass);
|
||||||
struct CData *cdata = class_data;
|
struct CData *cdata = class_data;
|
||||||
gchar *long_name;
|
gchar *long_name;
|
||||||
const gchar *name, *desc;
|
const gchar *name;
|
||||||
|
|
||||||
name = "Vulkan H.264 decoder";
|
name = "Vulkan H.264 decoder";
|
||||||
desc = "A H.264 video decoder based on Vulkan";
|
|
||||||
|
|
||||||
if (cdata->description)
|
if (cdata->description)
|
||||||
long_name = g_strdup_printf ("%s on %s", name, cdata->description);
|
long_name = g_strdup_printf ("%s on %s", name, cdata->description);
|
||||||
else
|
else
|
||||||
@ -1369,12 +1366,11 @@ gst_vulkan_h264_decoder_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
vk_h264_class->device_index = cdata->device_index;
|
vk_h264_class->device_index = cdata->device_index;
|
||||||
|
|
||||||
gst_element_class_set_metadata (element_class, long_name,
|
gst_element_class_set_metadata (element_class, long_name,
|
||||||
"Codec/Decoder/Video/Hardware", desc,
|
"Codec/Decoder/Video/Hardware", "A H.264 video decoder based on Vulkan",
|
||||||
"Víctor Jáquez <vjaquez@igalia.com>");
|
"Víctor Jáquez <vjaquez@igalia.com>");
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (g_klass);
|
parent_class = g_type_class_peek_parent (g_klass);
|
||||||
|
|
||||||
|
|
||||||
gst_element_class_add_static_pad_template (element_class,
|
gst_element_class_add_static_pad_template (element_class,
|
||||||
&gst_vulkan_h264dec_sink_template);
|
&gst_vulkan_h264dec_sink_template);
|
||||||
|
|
||||||
@ -1410,6 +1406,10 @@ gst_vulkan_h264_decoder_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
GST_DEBUG_FUNCPTR (gst_vulkan_h264_decoder_end_picture);
|
GST_DEBUG_FUNCPTR (gst_vulkan_h264_decoder_end_picture);
|
||||||
h264decoder_class->output_picture =
|
h264decoder_class->output_picture =
|
||||||
GST_DEBUG_FUNCPTR (gst_vulkan_h264_decoder_output_picture);
|
GST_DEBUG_FUNCPTR (gst_vulkan_h264_decoder_output_picture);
|
||||||
|
|
||||||
|
g_free (long_name);
|
||||||
|
g_free (cdata->description);
|
||||||
|
g_free (cdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -46,13 +46,11 @@ struct CData
|
|||||||
|
|
||||||
typedef struct _GstVulkanH265Decoder GstVulkanH265Decoder;
|
typedef struct _GstVulkanH265Decoder GstVulkanH265Decoder;
|
||||||
typedef struct _GstVulkanH265DecoderClass GstVulkanH265DecoderClass;
|
typedef struct _GstVulkanH265DecoderClass GstVulkanH265DecoderClass;
|
||||||
typedef struct _GstVulkanH265Decoder GstVulkanH265Decoder;
|
|
||||||
typedef struct _GstVulkanH265Picture GstVulkanH265Picture;
|
typedef struct _GstVulkanH265Picture GstVulkanH265Picture;
|
||||||
typedef struct _VPS VPS;
|
typedef struct _VPS VPS;
|
||||||
typedef struct _SPS SPS;
|
typedef struct _SPS SPS;
|
||||||
typedef struct _PPS PPS;
|
typedef struct _PPS PPS;
|
||||||
|
|
||||||
|
|
||||||
struct _SPS
|
struct _SPS
|
||||||
{
|
{
|
||||||
StdVideoH265SequenceParameterSet sps;
|
StdVideoH265SequenceParameterSet sps;
|
||||||
@ -1675,11 +1673,9 @@ gst_vulkan_h265_decoder_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
GST_VULKAN_H265_DECODER_CLASS (g_klass);
|
GST_VULKAN_H265_DECODER_CLASS (g_klass);
|
||||||
struct CData *cdata = class_data;
|
struct CData *cdata = class_data;
|
||||||
gchar *long_name;
|
gchar *long_name;
|
||||||
const gchar *name, *desc;
|
const gchar *name;
|
||||||
|
|
||||||
name = "Vulkan H.265 decoder";
|
name = "Vulkan H.265 decoder";
|
||||||
desc = "A H.265 video decoder based on Vulkan";
|
|
||||||
|
|
||||||
if (cdata->description)
|
if (cdata->description)
|
||||||
long_name = g_strdup_printf ("%s on %s", name, cdata->description);
|
long_name = g_strdup_printf ("%s on %s", name, cdata->description);
|
||||||
else
|
else
|
||||||
@ -1688,7 +1684,7 @@ gst_vulkan_h265_decoder_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
vk_h265_class->device_index = cdata->device_index;
|
vk_h265_class->device_index = cdata->device_index;
|
||||||
|
|
||||||
gst_element_class_set_metadata (element_class, long_name,
|
gst_element_class_set_metadata (element_class, long_name,
|
||||||
"Codec/Decoder/Video/Hardware", desc,
|
"Codec/Decoder/Video/Hardware", "A H.265 video decoder based on Vulkan",
|
||||||
"Víctor Jáquez <vjaquez@igalia.com>");
|
"Víctor Jáquez <vjaquez@igalia.com>");
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (g_klass);
|
parent_class = g_type_class_peek_parent (g_klass);
|
||||||
@ -1726,6 +1722,10 @@ gst_vulkan_h265_decoder_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
GST_DEBUG_FUNCPTR (gst_vulkan_h265_decoder_end_picture);
|
GST_DEBUG_FUNCPTR (gst_vulkan_h265_decoder_end_picture);
|
||||||
h265decoder_class->output_picture =
|
h265decoder_class->output_picture =
|
||||||
GST_DEBUG_FUNCPTR (gst_vulkan_h265_decoder_output_picture);
|
GST_DEBUG_FUNCPTR (gst_vulkan_h265_decoder_output_picture);
|
||||||
|
|
||||||
|
g_free (long_name);
|
||||||
|
g_free (cdata->description);
|
||||||
|
g_free (cdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -136,10 +136,9 @@ gst_vulkan_sink_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
element_class = GST_ELEMENT_CLASS (g_klass);
|
element_class = GST_ELEMENT_CLASS (g_klass);
|
||||||
struct CData *cdata = class_data;
|
struct CData *cdata = class_data;
|
||||||
gchar *long_name;
|
gchar *long_name;
|
||||||
const gchar *name, *desc;
|
const gchar *name;
|
||||||
|
|
||||||
name = "Vulkan Video sink";
|
name = "Vulkan Video sink";
|
||||||
desc = "A videosink based on Vulkan";
|
|
||||||
|
|
||||||
if (cdata->description)
|
if (cdata->description)
|
||||||
long_name = g_strdup_printf ("%s on %s", name, cdata->description);
|
long_name = g_strdup_printf ("%s on %s", name, cdata->description);
|
||||||
@ -167,7 +166,8 @@ gst_vulkan_sink_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
GST_TYPE_VULKAN_DEVICE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
GST_TYPE_VULKAN_DEVICE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
gst_element_class_set_metadata (element_class, long_name,
|
gst_element_class_set_metadata (element_class, long_name,
|
||||||
"Sink/Video", desc, "Matthew Waters <matthew@centricular.com>");
|
"Sink/Video", "A videosink based on Vulkan",
|
||||||
|
"Matthew Waters <matthew@centricular.com>");
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (g_klass);
|
parent_class = g_type_class_peek_parent (g_klass);
|
||||||
|
|
||||||
@ -186,6 +186,10 @@ gst_vulkan_sink_class_init (gpointer g_klass, gpointer class_data)
|
|||||||
|
|
||||||
gstvideosink_class->show_frame =
|
gstvideosink_class->show_frame =
|
||||||
GST_DEBUG_FUNCPTR (gst_vulkan_sink_show_frame);
|
GST_DEBUG_FUNCPTR (gst_vulkan_sink_show_frame);
|
||||||
|
|
||||||
|
g_free (long_name);
|
||||||
|
g_free (cdata->description);
|
||||||
|
g_free (cdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user