diff options
-rw-r--r-- | video/decode/vd_lavc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index c7ae13dfc5..1e7324457e 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -481,6 +481,9 @@ static void uninit_avctx(struct dec_video *vd) vd_ffmpeg_ctx *ctx = vd->priv; AVCodecContext *avctx = ctx->avctx; + flush_all(vd); + av_frame_free(&ctx->pic); + if (avctx) { if (avctx->codec && avcodec_close(avctx) < 0) MP_ERR(vd, "Could not close codec.\n"); @@ -494,10 +497,6 @@ static void uninit_avctx(struct dec_video *vd) av_freep(&ctx->avctx); - av_frame_free(&ctx->pic); - - flush_all(vd); - ctx->hwdec_failed = false; ctx->hwdec_fail_count = 0; ctx->max_delay_queue = 0; |