[FFmpeg-devel] [PATCH 2/5] lavc/qsvdec: Replace current parser with MFXVideoDECODE_DecodeHeader()

Li, Zhong zhong.li at intel.com
Fri Jan 25 12:43:16 EET 2019


> > +    ret = MFXVideoDECODE_DecodeHeader(q->session, &bs, &param);
> This function may potentially return MFX_ERR_MORE_DATA if provided
> bitstream don't contain full header. I am not sure whether ffmpeg will
> guarantee that... And the decoding error reported by Artie suggests that
> something is wrong around this. That can be ffmpeg or mediasdk issue -
> need to check what was the data which ffmpeg really passed to
> DecodeHeader.

MFX_ERROR_MORE_DATA should be handled, let me try to find such a clip and then updated this patch.
"decoding error reported by Artie" is another case I believe. Thus is due to P010 format hasn't been handled well,10bit hevc clip format 
is P010 but now it is treated as NV12 now. 

>          enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_QSV,
> -                                           AV_PIX_FMT_NONE,
> +                                           AV_PIX_FMT_NV12,
>                                             AV_PIX_FMT_NONE };

avctx->pix_fmt should be get from MFXVideoDECODE_DecodeHeader() but it is needed to init MSDK session, and looks like a deadlock, :(
One solution is that we assume avctx->format has been parsed somewhere else (such as avformat_find_stream_info() form libavformt) before start decoding.

> > +    if (ret < 0)
> > +        return ff_qsv_print_error(avctx, ret,
> > +                "Error decoding stream header");
> > +
> > +    avctx->width        = param.mfx.FrameInfo.CropW;
> > +    avctx->height       = param.mfx.FrameInfo.CropH;
> > +    avctx->coded_width  = param.mfx.FrameInfo.Width;
> > +    avctx->coded_height = param.mfx.FrameInfo.Height;
> > +    avctx->level        = param.mfx.CodecProfile;
> > +    avctx->profile      = param.mfx.CodecLevel;
> Typo here. You assign profile to level and level to profile.

Good catch. Will update, : ) 


More information about the ffmpeg-devel mailing list