vo_vaapi: cleanup error handling on init

Close the X connection if initializing vaapi fails.
This commit is contained in:
wm4 2014-05-28 01:07:24 +02:00
parent c0f85c18f8
commit 844656d135
2 changed files with 10 additions and 4 deletions

View File

@ -571,16 +571,17 @@ static int preinit(struct vo *vo)
VAStatus status;
if (!vo_x11_init(vo))
return -1;
goto fail;
p->display = vaGetDisplay(vo->x11->display);
if (!p->display)
return -1;
goto fail;
p->mpvaapi = va_initialize(p->display, p->log);
if (!p->mpvaapi) {
vaTerminate(p->display);
return -1;
p->display = NULL;
goto fail;
}
p->pool = va_surface_pool_alloc(p->mpvaapi, VA_RT_FORMAT_YUV420);
@ -630,6 +631,10 @@ static int preinit(struct vo *vo)
p->va_num_display_attrs = 0;
}
return 0;
fail:
uninit(vo);
return -1;
}
#define OPT_BASE_STRUCT struct priv

View File

@ -680,7 +680,8 @@ static void vo_x11_classhint(struct vo *vo, Window window, const char *name)
void vo_x11_uninit(struct vo *vo)
{
struct vo_x11_state *x11 = vo->x11;
assert(x11);
if (!x11)
return;
mp_input_put_key(vo->input_ctx, MP_INPUT_RELEASE_ALL);