mirror of https://github.com/mpv-player/mpv
hwdec_vaapi: close file descriptors even if surface export fails
otherwise they can leak
This commit is contained in:
parent
881f820fdf
commit
588d66fb25
|
@ -245,6 +245,12 @@ static int mapper_init(struct ra_hwdec_mapper *mapper)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void close_file_descriptors(VADRMPRIMESurfaceDescriptor desc)
|
||||
{
|
||||
for (int i = 0; i < desc.num_objects; i++)
|
||||
close(desc.objects[i].fd);
|
||||
}
|
||||
|
||||
static int mapper_map(struct ra_hwdec_mapper *mapper)
|
||||
{
|
||||
struct priv_owner *p_owner = mapper->owner->priv;
|
||||
|
@ -261,6 +267,7 @@ static int mapper_map(struct ra_hwdec_mapper *mapper)
|
|||
if (!CHECK_VA_STATUS_LEVEL(mapper, "vaExportSurfaceHandle()",
|
||||
p_owner->probing_formats ? MSGL_DEBUG : MSGL_ERR))
|
||||
{
|
||||
close_file_descriptors(desc);
|
||||
goto err;
|
||||
}
|
||||
vaSyncSurface(display, va_surface_id(mapper->src));
|
||||
|
|
Loading…
Reference in New Issue