summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 7c95f00e2c..de917a7820 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -517,11 +517,13 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
ctx->hwdec_w != avctx->coded_width ||
ctx->hwdec_h != avctx->coded_height ||
ctx->hwdec_fmt != ctx->hwdec->image_format ||
- ctx->hwdec_profile != avctx->profile;
+ ctx->hwdec_profile != avctx->profile ||
+ ctx->hwdec_request_reinit;
ctx->hwdec_w = avctx->coded_width;
ctx->hwdec_h = avctx->coded_height;
ctx->hwdec_fmt = ctx->hwdec->image_format;
ctx->hwdec_profile = avctx->profile;
+ ctx->hwdec_request_reinit = false;
if (ctx->hwdec->init_decoder && change) {
if (ctx->hwdec->init_decoder(ctx, ctx->hwdec_fmt,
ctx->hwdec_w, ctx->hwdec_h) < 0)
@@ -620,6 +622,9 @@ static int decode(struct dec_video *vd, struct demux_packet *packet,
return -1;
}
+ if (ctx->hwdec_request_reinit)
+ avcodec_flush_buffers(avctx);
+
// Skipped frame, or delayed output due to multithreaded decoding.
if (!got_picture)
return 0;