summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-28 01:07:24 +0200
committerwm4 <wm4@nowhere>2014-06-14 13:51:14 +0200
commit844656d1354fba3c3bda05af76cf9efe82af0935 (patch)
tree4b527c7af294919c0af1294363131c4ce2df64a1
parentc0f85c18f8ddf4874479ac7fa37e2ac0667e731a (diff)
downloadmpv-844656d1354fba3c3bda05af76cf9efe82af0935.tar.bz2
mpv-844656d1354fba3c3bda05af76cf9efe82af0935.tar.xz
vo_vaapi: cleanup error handling on init
Close the X connection if initializing vaapi fails.
-rw-r--r--video/out/vo_vaapi.c11
-rw-r--r--video/out/x11_common.c3
2 files changed, 10 insertions, 4 deletions
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index 4d64487746..cc5907ec2a 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -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
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 7403c0d892..4301c33e31 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -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);