Message ID | 20210312024406.642094-1-wenbin.chen@intel.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,V2] libavcodec/qsvdec.c: using queue count to unref frame | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Fri, 2021-03-12 at 10:44 +0800, wenbin.chen@intel.com wrote: > From: "Chen,Wenbin" <wenbin.chen@intel.com> > > MSDK vc1 and av1 sometimes output frame into the same suface, but > ffmpeg-qsv assume the surface will be used only once, so it will > unref the frame when it receives the output surface. Now change > it to unref frame according to queue count. > > Signed-off-by Wenbin Chen <wenbin.chen@intel.com> > --- > libavcodec/qsvdec.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c > index 5f2e641373..3abd7bd4a2 100644 > --- a/libavcodec/qsvdec.c > +++ b/libavcodec/qsvdec.c > @@ -513,7 +513,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext > *q, > return AVERROR_BUG; > } > > - out_frame->queued = 1; > + out_frame->queued += 1; > av_fifo_generic_write(q->async_fifo, &out_frame, sizeof(out_frame), > NULL); > av_fifo_generic_write(q->async_fifo, > &sync, sizeof(sync), NULL); > } else { > @@ -526,7 +526,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext > *q, > > av_fifo_generic_read(q->async_fifo, &out_frame, sizeof(out_frame), > NULL); > av_fifo_generic_read(q->async_fifo, > &sync, sizeof(sync), NULL); > - out_frame->queued = 0; > + out_frame->queued -= 1; > > if (avctx->pix_fmt != AV_PIX_FMT_QSV) { > do { LGTM, thanks!
On Fri, 2021-03-12 at 06:21 +0000, Xiang, Haihao wrote: > On Fri, 2021-03-12 at 10:44 +0800, wenbin.chen@intel.com wrote: > > From: "Chen,Wenbin" <wenbin.chen@intel.com> > > > > MSDK vc1 and av1 sometimes output frame into the same suface, but > > ffmpeg-qsv assume the surface will be used only once, so it will > > unref the frame when it receives the output surface. Now change > > it to unref frame according to queue count. > > > > Signed-off-by Wenbin Chen <wenbin.chen@intel.com> > > --- > > libavcodec/qsvdec.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c > > index 5f2e641373..3abd7bd4a2 100644 > > --- a/libavcodec/qsvdec.c > > +++ b/libavcodec/qsvdec.c > > @@ -513,7 +513,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext > > *q, > > return AVERROR_BUG; > > } > > > > - out_frame->queued = 1; > > + out_frame->queued += 1; > > av_fifo_generic_write(q->async_fifo, &out_frame, sizeof(out_frame), > > NULL); > > av_fifo_generic_write(q->async_fifo, > > &sync, sizeof(sync), NULL); > > } else { > > @@ -526,7 +526,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext > > *q, > > > > av_fifo_generic_read(q->async_fifo, &out_frame, sizeof(out_frame), > > NULL); > > av_fifo_generic_read(q->async_fifo, > > &sync, sizeof(sync), NULL); > > - out_frame->queued = 0; > > + out_frame->queued -= 1; > > > > if (avctx->pix_fmt != AV_PIX_FMT_QSV) { > > do { > > LGTM, thanks! Applied, thx! -Haihao
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 5f2e641373..3abd7bd4a2 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -513,7 +513,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q, return AVERROR_BUG; } - out_frame->queued = 1; + out_frame->queued += 1; av_fifo_generic_write(q->async_fifo, &out_frame, sizeof(out_frame), NULL); av_fifo_generic_write(q->async_fifo, &sync, sizeof(sync), NULL); } else { @@ -526,7 +526,7 @@ static int qsv_decode(AVCodecContext *avctx, QSVContext *q, av_fifo_generic_read(q->async_fifo, &out_frame, sizeof(out_frame), NULL); av_fifo_generic_read(q->async_fifo, &sync, sizeof(sync), NULL); - out_frame->queued = 0; + out_frame->queued -= 1; if (avctx->pix_fmt != AV_PIX_FMT_QSV) { do {
From: "Chen,Wenbin" <wenbin.chen@intel.com> MSDK vc1 and av1 sometimes output frame into the same suface, but ffmpeg-qsv assume the surface will be used only once, so it will unref the frame when it receives the output surface. Now change it to unref frame according to queue count. Signed-off-by Wenbin Chen <wenbin.chen@intel.com> --- libavcodec/qsvdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)