> From: Fu, Linjie > Sent: Sunday, September 30, 2018 9:01 AM > To: ffmpeg-devel@ffmpeg.org > Cc: Fu, Linjie <linjie...@intel.com>; Li, Zhong <zhong...@intel.com> > Subject: [PATCH] avcodec/qsvdec:flush the buffered data before reinit > > Flush the buffered data in libmfx before video param reinit in case the > frames drop. > > Cache the first frame causing the reinit and decode zero-size pkt to flush the > buffered pkt before reinit. After all the buffered pkts being flushed, resume > to reinit and decode. > > Fix the issue in ticket #7399. > > Modified in qsvdec_other.c as well. > > Signed-off-by: Linjie Fu <linjie...@intel.com> > Signed-off-by: Zhong Li <zhong...@intel.com> > --- > libavcodec/qsvdec.c | 12 ++++++++++++ > libavcodec/qsvdec.h | 2 ++ > libavcodec/qsvdec_h2645.c | 11 +++++++---- libavcodec/qsvdec_other.c | > 10 +++++++--- > 4 files changed, 28 insertions(+), 7 deletions(-) > > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index > 22e7a46a85..ca4500b456 100644 > --- a/libavcodec/qsvdec.c > +++ b/libavcodec/qsvdec.c > @@ -372,6 +372,8 @@ static int qsv_decode(AVCodecContext *avctx, > QSVContext *q, > ++q->zero_consume_run; > if (q->zero_consume_run > 1) > ff_qsv_print_warning(avctx, ret, "A decode call did not > consume any data"); > + } else if (!*sync && bs.DataOffset) { > + ++q->buffered_count; > } else { > q->zero_consume_run = 0; > } > @@ -493,6 +495,7 @@ int ff_qsv_process_data(AVCodecContext *avctx, > QSVContext *q, > int dummy_size; > int ret; > const AVPixFmtDescriptor *desc; > + AVPacket zero_pkt = {0}; > > if (!q->avctx_internal) { > q->avctx_internal = avcodec_alloc_context3(NULL); @@ -527,6 > +530,15 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext > *q, > AV_PIX_FMT_NONE }; > enum AVPixelFormat qsv_format;
Should be better to move zero_pkt here. The reset LGTM. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel