mirror of
https://github.com/mpv-player/mpv
synced 2025-02-03 21:52:12 +00:00
vo_vaapi: cleanup error handling on init
Close the X connection if initializing vaapi fails.
This commit is contained in:
parent
ff73d25308
commit
8dfd93c6fb
@ -571,16 +571,17 @@ static int preinit(struct vo *vo)
|
|||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
if (!vo_x11_init(vo))
|
if (!vo_x11_init(vo))
|
||||||
return -1;
|
goto fail;
|
||||||
|
|
||||||
p->display = vaGetDisplay(vo->x11->display);
|
p->display = vaGetDisplay(vo->x11->display);
|
||||||
if (!p->display)
|
if (!p->display)
|
||||||
return -1;
|
goto fail;
|
||||||
|
|
||||||
p->mpvaapi = va_initialize(p->display, p->log);
|
p->mpvaapi = va_initialize(p->display, p->log);
|
||||||
if (!p->mpvaapi) {
|
if (!p->mpvaapi) {
|
||||||
vaTerminate(p->display);
|
vaTerminate(p->display);
|
||||||
return -1;
|
p->display = NULL;
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->pool = mp_image_pool_new(MAX_OUTPUT_SURFACES + 3);
|
p->pool = mp_image_pool_new(MAX_OUTPUT_SURFACES + 3);
|
||||||
@ -631,6 +632,10 @@ static int preinit(struct vo *vo)
|
|||||||
p->va_num_display_attrs = 0;
|
p->va_num_display_attrs = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
uninit(vo);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OPT_BASE_STRUCT struct priv
|
#define OPT_BASE_STRUCT struct priv
|
||||||
|
@ -585,7 +585,8 @@ static void vo_x11_classhint(struct vo *vo, Window window, const char *name)
|
|||||||
void vo_x11_uninit(struct vo *vo)
|
void vo_x11_uninit(struct vo *vo)
|
||||||
{
|
{
|
||||||
struct vo_x11_state *x11 = vo->x11;
|
struct vo_x11_state *x11 = vo->x11;
|
||||||
assert(x11);
|
if (!x11)
|
||||||
|
return;
|
||||||
|
|
||||||
mp_input_put_key(vo->input_ctx, MP_INPUT_RELEASE_ALL);
|
mp_input_put_key(vo->input_ctx, MP_INPUT_RELEASE_ALL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user