Skip to content

Commit

Permalink
vdpau: fix hwdec uninit
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wm4 committed Nov 10, 2016
1 parent fc1017c commit ca17587
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions video/decode/vd_lavc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion video/decode/vdpau.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ca17587

Please sign in to comment.