[FFmpeg-devel] [PATCH] avcodec/av1dec: check avctx->hwaccel when hwaccel pix_fmt selected

Hendrik Leppkes h.leppkes at gmail.com
Thu Sep 17 12:21:00 EEST 2020


On Thu, Sep 17, 2020 at 10:38 AM Fei Wang <fei.w.wang at intel.com> wrote:
>
> Pix fmt with hwaccel flag may not be chosen in format probing, in
> this case avctx->hwaccel will not be inited.
>
> Signed-off-by: Fei Wang <fei.w.wang at intel.com>
> ---
>  libavcodec/av1dec.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
> index 0bb04a3e44..cdcc618013 100644
> --- a/libavcodec/av1dec.c
> +++ b/libavcodec/av1dec.c
> @@ -251,6 +251,7 @@ static int get_pixel_format(AVCodecContext *avctx)
>  {
>      AV1DecContext *s = avctx->priv_data;
>      const AV1RawSequenceHeader *seq = s->raw_seq;
> +    const AVPixFmtDescriptor *desc;
>      uint8_t bit_depth;
>      int ret;
>      enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
> @@ -327,10 +328,13 @@ static int get_pixel_format(AVCodecContext *avctx)
>       * Since now the av1 decoder doesn't support native decode, if it will be
>       * implemented in the future, need remove this check.
>       */
> -    if (!avctx->hwaccel) {
> -        av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport"
> -               " hardware accelerated AV1 decoding.\n");
> -        return AVERROR(ENOSYS);
> +    desc = av_pix_fmt_desc_get(ret);
> +    if (desc && (desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
> +        if (!avctx->hwaccel) {
> +            av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport"
> +                   " hardware accelerated AV1 decoding.\n");
> +            return AVERROR(ENOSYS);
> +        }
>      }
>

Isn't it supposed to quit here, because we do not have software decoding?

- Hendrik


More information about the ffmpeg-devel mailing list