[vlc-devel] [PATCH 24/36] vaapi: chroma: don't keep the decoder device after we put it in the vctx
Steve Lhomme
robux4 at ycbcr.xyz
Thu Nov 21 15:14:15 CET 2019
---
modules/hw/vaapi/chroma.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/modules/hw/vaapi/chroma.c b/modules/hw/vaapi/chroma.c
index 00d213e9588..d9b23745980 100644
--- a/modules/hw/vaapi/chroma.c
+++ b/modules/hw/vaapi/chroma.c
@@ -39,7 +39,6 @@
typedef struct
{
- vlc_decoder_device *dec_device;
VADisplay dpy;
picture_pool_t * dest_pics;
VASurfaceID * va_surface_ids;
@@ -345,22 +344,28 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
filter_sys->image_fallback_failed = false;
if (is_upload)
{
- filter_sys->dec_device = filter_HoldDecoderDevice( filter );
- if (filter_sys->dec_device == NULL)
+ vlc_decoder_device *dec_device = filter_HoldDecoderDevice( filter );
+ if (dec_device == NULL)
{
free(filter_sys);
return VLC_EGENERIC;
}
- if (filter_sys->dec_device->type != VLC_DECODER_DEVICE_VAAPI)
+ if (dec_device->type != VLC_DECODER_DEVICE_VAAPI)
{
- vlc_decoder_device_Release(filter_sys->dec_device);
+ vlc_decoder_device_Release(dec_device);
free(filter_sys);
return VLC_EGENERIC;
}
- filter_sys->dpy = filter_sys->dec_device->opaque;
+ filter->vctx_out = vlc_video_context_Create( dec_device, VLC_VIDEO_CONTEXT_VAAPI, 0, NULL );
+ vlc_decoder_device_Release(dec_device);
+ if (!filter->vctx_out)
+ {
+ free(filter_sys);
+ return VLC_EGENERIC;
+ }
- filter->vctx_out = vlc_video_context_Create( filter_sys->dec_device, VLC_VIDEO_CONTEXT_VAAPI, 0, NULL );
+ filter_sys->dpy = dec_device->opaque;
filter_sys->dest_pics =
vlc_vaapi_PoolNew(obj, filter->vctx_out, filter_sys->dpy,
@@ -368,7 +373,6 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
&filter->fmt_out.video);
if (!filter_sys->dest_pics)
{
- vlc_decoder_device_Release(filter_sys->dec_device);
vlc_video_context_Release(filter->vctx_out);
filter->vctx_out = NULL;
free(filter_sys);
@@ -379,7 +383,6 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
{
/* Don't fetch the vaapi instance since it may be not created yet at
* this point (in case of cpu rendering) */
- filter_sys->dec_device = NULL;
filter_sys->dpy = NULL;
filter_sys->dest_pics = NULL;
}
@@ -390,7 +393,6 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
if (is_upload)
{
picture_pool_Release(filter_sys->dest_pics);
- vlc_decoder_device_Release(filter_sys->dec_device);
vlc_video_context_Release(filter->vctx_out);
filter->vctx_out = NULL;
}
@@ -416,8 +418,6 @@ vlc_vaapi_CloseChroma(vlc_object_t *obj)
if (filter_sys->dest_pics)
picture_pool_Release(filter_sys->dest_pics);
- if (filter_sys->dec_device != NULL)
- vlc_decoder_device_Release(filter_sys->dec_device);
CopyCleanCache(&filter_sys->cache);
if (filter->vctx_out)
vlc_video_context_Release(filter->vctx_out);
--
2.17.1
More information about the vlc-devel
mailing list