diff options
author | wm4 <wm4@nowhere> | 2016-11-10 08:39:09 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-11-10 08:39:09 +0100 |
commit | ca175871cd509f5bd629597c1e0417d4243b9742 (patch) | |
tree | ae8d8195fa631e0e37ddd34b446a6cf56bff1076 | |
parent | fc1017c33533d4d2e0b82cef6cbf45ca64122950 (diff) | |
download | mpv-ca175871cd509f5bd629597c1e0417d4243b9742.tar.bz2 mpv-ca175871cd509f5bd629597c1e0417d4243b9742.tar.xz |
vdpau: fix hwdec uninit
This is a bit unintuitiv, but it appears hwdec backends have to unset
hwdec_priv manually in their uninit function. Normally with this idiom
you'd expect the common code to do this (and maybe even freeing the priv
struct). Since other hwdec backends do this quite consistently, just fix
vdpau for now.
Also add an assert to detect similar bugs sooner.
Fixes #3788.
-rw-r--r-- | video/decode/vd_lavc.c | 1 | ||||
-rw-r--r-- | video/decode/vdpau.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 72209f5048..d25c99981e 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -598,6 +598,7 @@ static void uninit_avctx(struct dec_video *vd) if (ctx->hwdec && ctx->hwdec->uninit) ctx->hwdec->uninit(ctx); ctx->hwdec = NULL; + assert(ctx->hwdec_priv == NULL); av_freep(&ctx->avctx); diff --git a/video/decode/vdpau.c b/video/decode/vdpau.c index a86f5d1edf..93a1e6d9a3 100644 --- a/video/decode/vdpau.c +++ b/video/decode/vdpau.c @@ -86,7 +86,7 @@ static void uninit(struct lavc_ctx *ctx) XCloseDisplay(p->display); } - talloc_free(p); + TA_FREEP(&ctx->hwdec_priv); if (ctx->avctx) av_freep(&ctx->avctx->hwaccel_context); |