From 494169aad4150eb680415e8ef9bc1ff21e27cb7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Thu, 22 Sep 2022 18:53:30 +0200 Subject: [PATCH] vadecoder: remove display reference in decode picture Since it's possible to grab the VA display from the GstBuffer and GstMemory, there's no need to keep a reference to it in GstVaDecodePicture. Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvadecoder.c | 11 +++++------ subprojects/gst-plugins-bad/sys/va/gstvadecoder.h | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvadecoder.c b/subprojects/gst-plugins-bad/sys/va/gstvadecoder.c index a1f50d39ed..8935178018 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvadecoder.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvadecoder.c @@ -725,15 +725,17 @@ gst_va_decoder_get_config (GstVaDecoder * self, VAProfile * profile, static gboolean _destroy_buffers (GstVaDecodePicture * pic) { + GstVaDisplay *display; VABufferID buffer; VADisplay dpy; VAStatus status; guint i; gboolean ret = TRUE; - g_return_val_if_fail (GST_IS_VA_DISPLAY (pic->display), FALSE); - - dpy = gst_va_display_get_va_dpy (pic->display); + display = gst_va_buffer_peek_display (pic->gstbuffer); + if (!display) + return FALSE; + dpy = gst_va_display_get_va_dpy (display); if (pic->buffers) { for (i = 0; i < pic->buffers->len; i++) { @@ -777,7 +779,6 @@ gst_va_decode_picture_new (GstVaDecoder * self, GstBuffer * buffer) pic->gstbuffer = gst_buffer_ref (buffer); pic->buffers = g_array_sized_new (FALSE, FALSE, sizeof (VABufferID), 16); pic->slices = g_array_sized_new (FALSE, FALSE, sizeof (VABufferID), 64); - pic->display = gst_object_ref (self->display); return pic; } @@ -810,7 +811,6 @@ gst_va_decode_picture_free (GstVaDecodePicture * pic) gst_buffer_unref (pic->gstbuffer); g_clear_pointer (&pic->buffers, g_array_unref); g_clear_pointer (&pic->slices, g_array_unref); - gst_clear_object (&pic->display); g_free (pic); } @@ -824,7 +824,6 @@ gst_va_decode_picture_dup (GstVaDecodePicture * pic) dup = g_new0 (GstVaDecodePicture, 1); - dup->display = gst_object_ref (pic->display); /* dups only need gstbuffer */ dup->gstbuffer = gst_buffer_ref (pic->gstbuffer); return dup; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvadecoder.h b/subprojects/gst-plugins-bad/sys/va/gstvadecoder.h index c643995f4a..7c3cbd82ff 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvadecoder.h +++ b/subprojects/gst-plugins-bad/sys/va/gstvadecoder.h @@ -28,7 +28,6 @@ G_BEGIN_DECLS typedef struct _GstVaDecodePicture GstVaDecodePicture; struct _GstVaDecodePicture { - GstVaDisplay *display; GArray *buffers; GArray *slices; GstBuffer *gstbuffer;