From cd341e3c4f0f68a5542216be882e7c639b3ae6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Tue, 11 Jan 2022 20:46:16 +0200 Subject: [PATCH] vdpau: hold video context when creating a field --- modules/hw/vdpau/avcodec.c | 1 + modules/hw/vdpau/picture.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c index 9ec7928562..9d4305cbc3 100644 --- a/modules/hw/vdpau/avcodec.c +++ b/modules/hw/vdpau/avcodec.c @@ -73,6 +73,7 @@ static vlc_vdp_video_field_t *CreateSurface(vlc_va_t *va, vdpau_decoder_device_t vlc_vdp_video_field_t *field = vlc_vdp_video_create(sys->vctx, surface); if (unlikely(field == NULL)) vdp_video_surface_destroy(vdpau_decoder->vdp, surface); + vlc_video_context_Release(sys->vctx); return field; } diff --git a/modules/hw/vdpau/picture.c b/modules/hw/vdpau/picture.c index 6b6eb02fed..4e3d269443 100644 --- a/modules/hw/vdpau/picture.c +++ b/modules/hw/vdpau/picture.c @@ -98,7 +98,7 @@ vlc_vdp_video_field_t *vlc_vdp_video_create(struct vlc_video_context *vctx, } field->context = (picture_context_t) { - VideoSurfaceDestroy, VideoSurfaceCopy, vctx, + VideoSurfaceDestroy, VideoSurfaceCopy, vlc_video_context_Hold(vctx), }; field->frame = frame; field->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; @@ -129,7 +129,6 @@ VdpStatus vlc_vdp_video_attach(struct vlc_video_context *vctx, field->context.destroy = VideoSurfaceDestroy; field->context.copy = VideoSurfaceCloneWithContext; - field->context.vctx = vlc_video_context_Hold(vctx); assert(pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_420 || pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_422