diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 7ac92d6901..455ae892db 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -430,7 +430,7 @@ static void uninit_avctx(struct dec_video *vd) vd_ffmpeg_ctx *ctx = vd->priv; AVCodecContext *avctx = ctx->avctx; - if (avctx && avctx->codec) + if (avctx && avcodec_is_open(avctx)) avcodec_flush_buffers(avctx); if (ctx->hwdec && ctx->hwdec->uninit)