From 543d54d492c33a59238ac932b765be314dd56d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Mon, 4 Jan 2021 20:56:26 +0100 Subject: [PATCH] va: display: add function precondition check Part-of: --- sys/va/gstvadisplay.c | 6 +++++- sys/va/gstvadisplay.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/va/gstvadisplay.c b/sys/va/gstvadisplay.c index c5416f5f3e..0d265ac5fc 100644 --- a/sys/va/gstvadisplay.c +++ b/sys/va/gstvadisplay.c @@ -374,11 +374,15 @@ gst_va_display_get_image_formats (GstVaDisplay * self) { GArray *ret = NULL; GstVideoFormat format; - VADisplay dpy = gst_va_display_get_va_dpy (self); + VADisplay dpy; VAImageFormat *va_formats; VAStatus status; int i, max, num = 0; + g_return_val_if_fail (GST_IS_VA_DISPLAY (self), NULL); + + dpy = gst_va_display_get_va_dpy (self); + gst_va_display_lock (self); max = vaMaxNumImageFormats (dpy); gst_va_display_unlock (self); diff --git a/sys/va/gstvadisplay.h b/sys/va/gstvadisplay.h index a110b463e2..c5f54d30e9 100644 --- a/sys/va/gstvadisplay.h +++ b/sys/va/gstvadisplay.h @@ -44,6 +44,6 @@ VADisplay gst_va_display_get_va_dpy (GstVaDisplay * self); GArray * gst_va_display_get_profiles (GstVaDisplay * self, guint32 codec, VAEntrypoint entrypoint); -GArray * gst_va_display_get_image_formats (GstVaDisplay * display); +GArray * gst_va_display_get_image_formats (GstVaDisplay * self); G_END_DECLS