mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
display: always free VA display cache if it is empty.
This commit is contained in:
parent
9516f00f8e
commit
674ea91faa
1 changed files with 17 additions and 3 deletions
|
@ -51,11 +51,11 @@ enum {
|
|||
PROP_HEIGHT
|
||||
};
|
||||
|
||||
static GstVaapiDisplayCache *g_display_cache = NULL;
|
||||
|
||||
static inline GstVaapiDisplayCache *
|
||||
get_display_cache(void)
|
||||
{
|
||||
static GstVaapiDisplayCache *g_display_cache = NULL;
|
||||
|
||||
if (!g_display_cache)
|
||||
g_display_cache = gst_vaapi_display_cache_new();
|
||||
return g_display_cache;
|
||||
|
@ -67,6 +67,17 @@ gst_vaapi_display_get_cache(void)
|
|||
return get_display_cache();
|
||||
}
|
||||
|
||||
static void
|
||||
free_display_cache(void)
|
||||
{
|
||||
if (!g_display_cache)
|
||||
return;
|
||||
if (gst_vaapi_display_cache_get_size(g_display_cache) > 0)
|
||||
return;
|
||||
gst_vaapi_display_cache_free(g_display_cache);
|
||||
g_display_cache = NULL;
|
||||
}
|
||||
|
||||
/* Append GstVaapiImageFormat to formats array */
|
||||
static inline void
|
||||
append_format(GArray *formats, GstVaapiImageFormat format)
|
||||
|
@ -314,7 +325,10 @@ gst_vaapi_display_destroy(GstVaapiDisplay *display)
|
|||
priv->parent = NULL;
|
||||
}
|
||||
|
||||
gst_vaapi_display_cache_remove(get_display_cache(), display);
|
||||
if (g_display_cache) {
|
||||
gst_vaapi_display_cache_remove(get_display_cache(), display);
|
||||
free_display_cache();
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue