Commit 707d7b50 authored by Jean-Paul Saman's avatar Jean-Paul Saman

codec/avcodec/vaapi_x11.c: Cleanup

- Renamed PictureReleaseLocked to ReleaseSurfaceLocked
- Cleanup code paths
parent afc54207
......@@ -720,9 +720,9 @@ static void Render(vout_display_t *vd, picture_t *picture, subpicture_t *subpict
if (subpicture->b_ephemer)
return;
if (!picture->p_sys &&
(picture->format.i_chroma != VLC_CODEC_VAAPI_SURFACE))
if (picture->format.i_chroma != VLC_CODEC_VAAPI_SURFACE)
{
assert(picture->p_sys);
picture->p_sys = RenderImportPicture(vd, picture);
if (!picture->p_sys)
return;
......@@ -755,15 +755,10 @@ static void Render(vout_display_t *vd, picture_t *picture, subpicture_t *subpict
vlc_mutex_unlock(&picture->p_sys->surface->lock);
}
static void PictureReleaseLocked(picture_t *pic)
static void ReleaseSurfaceLocked(vlc_va_surface_t *surface)
{
assert(pic);
if (pic->p_sys && pic->p_sys->surface)
{
pic->p_sys->surface->i_refcount--;
assert(pic->p_sys->surface->i_refcount >= 0);
}
surface->i_refcount--;
assert(surface->i_refcount >= 0);
}
static void DisplayVASurface(vout_display_t *vd, VASurfaceID surface, picture_t *picture)
......@@ -822,35 +817,29 @@ static void DisplayPicture(vout_display_t *vd, picture_t *pic, subpicture_t *sub
pic->p_sys->surface->i_refcount, pic);
if (pic->p_sys->surface->i_refcount > 1)
pic->p_sys->surface->i_refcount = 1;
if (subpicture)
{
SubpictureDestroy(vd, pic->p_sys->surface);
subpicture_Delete(subpicture);
}
PictureReleaseLocked(pic);
vlc_mutex_unlock(&pic->p_sys->surface->lock);
pic->p_sys->surface = NULL;
picture_Release(pic);
return;
goto cleanup;
}
DisplayVASurface(vd, pic->p_sys->surface->i_id, pic);
cleanup:
if (subpicture)
{
SubpictureDestroy(vd, pic->p_sys->surface);
subpicture_Delete(subpicture);
}
PictureReleaseLocked(pic);
vlc_mutex_unlock(&pic->p_sys->surface->lock);
if (pic->p_sys->b_own_vout)
{
if (pic->p_sys->surface->i_id != VA_INVALID_SURFACE)
vaDestroySurfaces(sys->conn->p_display, &pic->p_sys->surface->i_id, 1);
}
else pic->p_sys->surface = NULL;
ReleaseSurfaceLocked(pic->p_sys->surface);
vlc_mutex_unlock(&pic->p_sys->surface->lock);
if (!pic->p_sys->b_own_vout)
pic->p_sys->surface = NULL;
picture_Release(pic);
}
......
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