Commit 57c5e16c authored by Jean-Paul Saman's avatar Jean-Paul Saman

codec/avcodec/vaapi_x11.c: Potential picture leaks.

- do picture refcounting from pf_release() functions.
parent 707d7b50
......@@ -691,6 +691,8 @@ static int RenderDirectSubpicture(vout_display_t *vd, picture_t *picture, subpic
static void PictureRelease(picture_t *picture)
{
if (picture->i_refcount > 0)
picture->i_refcount--;
free(picture->p_sys);
picture->p_sys = NULL;
}
......@@ -700,6 +702,9 @@ static void PictureReleaseVoutOwned(picture_t *picture)
if (!picture->p_sys->b_own_vout)
abort();
if (picture->i_refcount > 0)
picture->i_refcount--;
vlc_va_surface_t *surface = picture->p_sys->surface;
#if 0
/* FIXME: pictures discarded by core will leak VASurfaces */
......@@ -726,12 +731,13 @@ static void Render(vout_display_t *vd, picture_t *picture, subpicture_t *subpict
picture->p_sys = RenderImportPicture(vd, picture);
if (!picture->p_sys)
return;
assert(picture->p_sys->surface);
assert(picture->pf_release);
picture->pf_release = PictureReleaseVoutOwned;
}
if (picture->p_sys->surface == NULL)
abort();
return;
vlc_mutex_lock(&picture->p_sys->surface->lock);
......@@ -757,7 +763,8 @@ static void Render(vout_display_t *vd, picture_t *picture, subpicture_t *subpict
static void ReleaseSurfaceLocked(vlc_va_surface_t *surface)
{
surface->i_refcount--;
if (surface->i_refcount > 0)
surface->i_refcount--;
assert(surface->i_refcount >= 0);
}
......@@ -797,6 +804,7 @@ static void DisplayPicture(vout_display_t *vd, picture_t *pic, subpicture_t *sub
if (pic->p_sys->surface == NULL)
{
assert(!pic->p_sys->b_own_vout);
msg_Err(vd, "Discarding picture without surface information");
if (subpicture)
subpicture_Delete(subpicture);
......
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