summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-27 04:54:15 +0100
committerKevin Mitchell <kevmitch@gmail.com>2017-12-27 01:52:09 -0700
commit9708248eb359037fc3858c464389e8bc5a3161cd (patch)
tree14d4ebcae7056d7a6924287e047843053f8cc41a
parentb51f6c59b9689b163a4ced2cd4ee9b7242eaf958 (diff)
downloadmpv-9708248eb359037fc3858c464389e8bc5a3161cd.tar.bz2
mpv-9708248eb359037fc3858c464389e8bc5a3161cd.tar.xz
vf_vdpaupp: fix error handling and software input mode
Crashed when no vdpau device was loaded. Also there was a mistake of not setting p->ctx, which broke software surface input mode. This was not found before, because p->ctx is not needed for anything else. Fixes #5294.
-rw-r--r--video/filter/vf_vdpaupp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/video/filter/vf_vdpaupp.c b/video/filter/vf_vdpaupp.c
index de1979cf05..391dc9e6b1 100644
--- a/video/filter/vf_vdpaupp.c
+++ b/video/filter/vf_vdpaupp.c
@@ -183,18 +183,22 @@ static int vf_open(vf_instance_t *vf)
hwdec_devices_request_all(vf->hwdec_devs);
AVBufferRef *ref =
hwdec_devices_get_lavc(vf->hwdec_devs, AV_HWDEVICE_TYPE_VDPAU);
- struct mp_vdpau_ctx *ctx = mp_vdpau_get_ctx_from_av(ref);
+ if (!ref)
+ goto error;
+ p->ctx = mp_vdpau_get_ctx_from_av(ref);
av_buffer_unref(&ref);
- if (!ctx) {
- uninit(vf);
- return 0;
- }
+ if (!p->ctx)
+ goto error;
p->def_deintmode = p->opts.deint;
if (!p->deint_enabled)
p->opts.deint = 0;
return 1;
+
+error:
+ uninit(vf);
+ return 0;
}
#define OPT_BASE_STRUCT struct vf_priv_s