[FFmpeg-devel] [PATCH] avcodec/av1dec: Adjust incorrect error output

Wang, Fei W fei.w.wang at intel.com
Fri Aug 27 06:05:22 EEST 2021


> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of Soft
> Works
> Sent: Thursday, August 26, 2021 5:12 AM
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] avcodec/av1dec: Adjust incorrect error
> output
> 
> 
> 
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> > Wang, Fei W
> > Sent: Tuesday, 24 August 2021 07:32
> > To: ffmpeg-devel at ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH] avcodec/av1dec: Adjust incorrect
> > error output
> >
> > On Tue, 2021-08-24 at 02:45 +0000, Soft Works wrote:
> > > > -----Original Message-----
> > > > From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> > > > Ronald S. Bultje
> > > > Sent: Tuesday, 24 August 2021 04:34
> > > > To: FFmpeg development discussions and patches <ffmpeg-
> > > > devel at ffmpeg.org>
> > > > Subject: Re: [FFmpeg-devel] [PATCH] avcodec/av1dec: Adjust
> > > > incorrect error output
> > > >
> > > > Hi,
> > > >
> > > > On Mon, Aug 23, 2021 at 9:39 PM Soft Works
> > <softworkz at hotmail.com>
> > > > wrote:
> > > >
> > > > > The current message "Your platform doesn't suppport hardware
> > > > > accelerated AV1 decoding." is inaccurate and misleading. When a
> > > > > user doesn't specify a hwcaccel, this doesn't tell anything
> > > > > about what is actually supported on that platform.
> > > > >
> > > > > Signed-off-by: softworkz <softworkz at hotmail.com>
> > > > > ---
> > > > >  libavcodec/av1dec.c | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index
> > > > > a75d6744d3..8dfcd26cb6 100644
> > > > > --- a/libavcodec/av1dec.c
> > > > > +++ b/libavcodec/av1dec.c
> > > > > @@ -462,8 +462,8 @@ static int get_pixel_format(AVCodecContext
> > > >
> > > > *avctx)
> > > > >       * 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");
> > > > > +        av_log(avctx, AV_LOG_ERROR, "AV1 decoding requires a
> > hw
> > > > > acceleration"
> > > > > +               " to be specified.\n");
> > > > >
> > > >
> > > > This is misleading.
> > > >
> > > > This error message (for me) happens when I accidentally compile
> > > > FFmpeg without aom/dav1d support, and try to play AV1 content.
> > >
> > > It also happens to me when I specify:
> > >
> > > ffmpeg -c:v av1 -i INPUT OUTPUT
> > >
> > > (e.g. like when I'd have forgotten to specify the hwaccel)
> > >
> > > > AV1 decoding
> > > > does
> > > > not require hw decoding - it simply requires an external library.
> > > >
> > > > Will the hwaccel be autodetected when AV1 hw decoding is
> > supported
> > > > by
> > > > the
> > > > platform?
> > >
> > > No.
> > >
> > > How about this: "The AV1 decoder requires a hw acceleration to be
> > > specified." ?
> >
> > This will bring new misleading if user specify the hw acceleration but
> > the hardware itself doesn't support av1 dec.
> 
> Such situations may happen, but this is not subject of this patch.
> This patch is about the error that is printed when no hw acceleration has been
> specified.

Yes, I understand your purpose. But here avctx->hwaccel==NULL does not
 stands for hw acceleration has not been specified in a hundred percent. If specificed hw
acceleration init fail in ff_thread_get_format which is just 1 line above your modify, 
then avctx->hwaccel will be NULL too. And even the hw init fail, return value of 
ff_thread_get_format may 0 with some error log printed. For example run the cmd
on Skylake:
$ ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -v verbose -i av1.ivf -pix_fmt yuv420p -vsync passthrough -f null -

Output log will be:
[av1 @ 0x556613499fc0] No support for codec av1 profile 0.
[av1 @ 0x556613499fc0] Failed setup for format vaapi: hwaccel initialisation returned error.
[av1 @ 0x556613499fc0] Your platform doesn't suppport hardware accelerated AV1 decoding.
[av1 @ 0x556613499fc0] Failed to get pixel format.

If you just want to make sure weather hw is specified, maybe can use
avctx->hw_device_ctx instead of avctx->hwaccel. And better to put the check before
calling ff_thread_get_format.

> 
> If the specified hw accel is not available or cannot be initialized, then there will
> be an error reported at an earlier stage.
> 
> If the specified hw accel has been initialized successfully but the hwaccel doesn't
> support AV1, this check won't catch it anyway.

This will not happen for VAAPI. If hwaccel doesn't support AV1, the hw accel init
will not success.

Fei
Thanks

> 
> Kind regards,
> softworkz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email ffmpeg-devel-request at ffmpeg.org
> with subject "unsubscribe".


More information about the ffmpeg-devel mailing list