[FFmpeg-devel] [PATCH 2/3] libavutil/hwcontext_qsv: fix a bug for mapping vaapi frame to qsv

Anton Khirnov anton at khirnov.net
Mon Nov 29 11:39:45 EET 2021


Quoting Chen, Wenbin (2021-11-23 02:56:37)
> > From: nyanmisaka <nst799610810 at gmail.com>
> > 
> > The data stored in data[3] in VAAPI AVFrame is VASurfaceID while
> > the data stored in pair->first is the pointer of VASurfaceID, so
> > we need to do cast to make following commandline works:
> > 
> > ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
> > -hwaccel_output_format vaapi -i input.264 \
> > -vf "hwmap=derive_device=qsv,format=qsv" -c:v h264_qsv output.264
> > 
> > Signed-off-by: nyanmisaka <nst799610810 at gmail.com>
> > Signed-off-by: Wenbin Chen <wenbin.chen at intel.com>
> > ---
> >  libavutil/hwcontext_qsv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
> > index c18747f7eb..d83754193a 100644
> > --- a/libavutil/hwcontext_qsv.c
> > +++ b/libavutil/hwcontext_qsv.c
> > @@ -1220,7 +1220,7 @@ static int qsv_map_to(AVHWFramesContext
> > *dst_ctx,
> >          case AV_PIX_FMT_VAAPI:
> >          {
> >              mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId;
> > -            if (pair->first == src->data[3]) {
> > +            if (*(VASurfaceID*)pair->first == (VASurfaceID)src->data[3]) {
> >                  index = i;
> >                  break;
> >              }

Looks good, will push.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list