Commit 84b2150b authored by Jean-Paul Saman's avatar Jean-Paul Saman

VAAPI vout: release picture itself when refcount reaches 0

The PictureRelease function is being overriden by the vaapi_vout module, but
forgot to release the associated picture when refcount reached zero. This results
in a memory leak for the pictures.

The memleak is solved by this patch.
parent 63b581b3
...@@ -180,10 +180,11 @@ static void PictureUnlock(picture_t *picture) ...@@ -180,10 +180,11 @@ static void PictureUnlock(picture_t *picture)
/* PictureRelease is called when the picture pool is destroyed. */ /* PictureRelease is called when the picture pool is destroyed. */
static void PictureRelease(picture_t *picture) static void PictureRelease(picture_t *picture)
{ {
if (picture->i_refcount > 0)
picture->i_refcount--;
picture->p_sys = NULL; picture->p_sys = NULL;
if (--picture->i_refcount > 0)
return;
picture_Delete(picture);
} }
/** /**
...@@ -282,7 +283,7 @@ error: ...@@ -282,7 +283,7 @@ error:
vlc_va_surface_t *surface = (vlc_va_surface_t *) pic->p_sys; vlc_va_surface_t *surface = (vlc_va_surface_t *) pic->p_sys;
vlc_va_conn_ReleaseSurface(va, surface); vlc_va_conn_ReleaseSurface(va, surface);
} }
picture_Release(pic); picture_Delete(pic);
} }
free(pic_array); free(pic_array);
va->unlock(); va->unlock();
......
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