Commit 1701048c authored by Jean-Paul Saman's avatar Jean-Paul Saman

VAAPI-X11: Freeing subpictures should not be done from picture->pf_release() now.

Subpictures are already detached from the surface and can de free'd independently.
parent 10f43347
......@@ -1244,48 +1244,6 @@ again:
}
}
/* PictureRelease is called when the picture pool is destroyed. */
static void PictureRelease(picture_t *picture)
{
if (picture->i_refcount > 0)
picture->i_refcount--;
if (picture->p_sys &&
(picture->p_sys->i_id != VA_INVALID_SURFACE))
{
vout_display_t *vd = (vout_display_t *)picture->p_sys->obj;
picture_sys_t *surface = picture->p_sys;
if (surface && (surface->i_cache > 0))
{
assert(0);
vlc_mutex_lock(&vd->sys->cache_lock);
#ifdef VAAPI_DEBUG
msg_Dbg(vd, "unlink surface %d cache %d", surface->i_id, surface->i_cache);
#endif
subpicture_cache_t *cache = cache_find(&vd->sys->cache, surface->i_cache);
if (cache)
{
cache_unref(cache);
if (cache->i_refcount == 0)
{
int index = vlc_array_index_of_item(&vd->sys->cache, (void*)cache);
vlc_array_remove(&vd->sys->cache, index);
SubpictureDestroy(vd, vd->sys->conn, cache);
cache_destroy(cache);
cache = NULL;
}
}
vlc_mutex_unlock(&vd->sys->cache_lock);
}
surface->i_cache = 0;
}
free(picture->p_sys);
picture->p_sys = NULL;
}
static void DisplayVASurface(vout_display_t *vd, picture_t *picture)
{
vout_display_sys_t *sys = vd->sys;
......@@ -1369,41 +1327,18 @@ static void PictureUnlock(picture_t *picture)
if (surface == NULL)
return;
#if 0
if (surface->i_cache > 0)
{
vout_display_t *vd = (vout_display_t*) picture->p_sys->obj;
vout_display_sys_t *sys = (vout_display_sys_t *) vd->sys;
vlc_mutex_lock(&sys->cache_lock);
#ifdef VAAPI_DEBUG
msg_Dbg(vd, "unlink surface %d cache %d", surface->i_id, surface->i_cache);
#endif
subpicture_cache_t *cache = cache_find(&sys->cache, surface->i_cache);
if (cache)
{
cache_unref(cache);
/* Do we still need need this subpicture cache ? */
if ((cache->i_refcount == 0) &&
(sys->render.i_cache != surface->i_cache) &&
(mdate() > cache->i_stop))
{
int index = vlc_array_index_of_item(&sys->cache, (void*)cache);
vlc_array_remove(&sys->cache, index);
SubpictureDestroy(vd, sys->conn, cache);
cache_destroy(cache);
cache = NULL;
}
}
vlc_mutex_unlock(&sys->cache_lock);
}
#endif
/* */
if (surface->i_refcount > 0)
surface->i_refcount--;
}
surface->i_cache = 0;
/* PictureRelease is called when the picture pool is destroyed. */
static void PictureRelease(picture_t *picture)
{
if (picture->i_refcount > 0)
picture->i_refcount--;
free(picture->p_sys);
picture->p_sys = NULL;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment