1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 00:42:57 +00:00

vf_vavpp: move vaMapBuffer() closer to its use

The mapped data (pointed to by the param variable) is not needed before,
so the call can be moved down. Also, this prevents that the buffer
remains mapped forever if the other vaMapBuffer() call above fails (the
cleanup code forgets to unmap the buffer - this commit makes it
unnecessary).
This commit is contained in:
wm4 2015-06-01 01:34:55 +02:00
parent 8e010a500d
commit ebde784fab

View File

@ -156,10 +156,6 @@ static struct mp_image *render(struct vf_instance *vf, struct mp_image *in,
if (!check_error(vf, status, "vaCreateBuffer()")) if (!check_error(vf, status, "vaCreateBuffer()"))
goto cleanup; goto cleanup;
status = vaMapBuffer(p->display, buffer, (void**)&param);
if (!check_error(vf, status, "vaMapBuffer()"))
goto cleanup;
VAProcFilterParameterBufferDeinterlacing *filter_params; VAProcFilterParameterBufferDeinterlacing *filter_params;
status = vaMapBuffer(p->display, *(p->pipe.filters), (void**)&filter_params); status = vaMapBuffer(p->display, *(p->pipe.filters), (void**)&filter_params);
if (!check_error(vf, status, "vaMapBuffer()")) if (!check_error(vf, status, "vaMapBuffer()"))
@ -171,6 +167,10 @@ static struct mp_image *render(struct vf_instance *vf, struct mp_image *in,
vaUnmapBuffer(p->display, *(p->pipe.filters)); vaUnmapBuffer(p->display, *(p->pipe.filters));
status = vaMapBuffer(p->display, buffer, (void**)&param);
if (!check_error(vf, status, "vaMapBuffer()"))
goto cleanup;
param->surface = in_id; param->surface = in_id;
param->surface_region = NULL; param->surface_region = NULL;
param->output_region = NULL; param->output_region = NULL;