[FFmpeg-devel] [PATCH] add an option to forbid the fallback to sw when hardware init fails

Fu, Linjie linjie.fu at intel.com
Thu Nov 8 10:28:54 EET 2018


> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Hendrik Leppkes
> Sent: Tuesday, October 30, 2018 17:11
> To: FFmpeg development discussions and patches <ffmpeg-
> devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH] add an option to forbid the fallback to
> sw when hardware init fails
> 
> On Tue, Oct 30, 2018 at 10:08 AM Linjie Fu <linjie.fu at intel.com> wrote:
> >
> > Currently ff_get_format will go through all usable choices if the
> > chosen format was not supported. It will fallback to software if
> > the hardware init fails.
> >
> > According to the comment in ticket #7519, provided an option
> > "-fallback_forbid 1" to return directly if hardware init fails
> > and forbid the fallback to software.
> >
> > Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> > ---
> >  libavcodec/avcodec.h       |  8 ++++++++
> >  libavcodec/decode.c        | 11 +++++++++--
> >  libavcodec/options_table.h |  1 +
> >  3 files changed, 18 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 705a3ce4f3..fac3c6acb2 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -3312,6 +3312,14 @@ typedef struct AVCodecContext {
> >       * used as reference pictures).
> >       */
> >      int extra_hw_frames;
> > +
> > +    /**
> > +     * - forbid the fallback to software path in ff_get_format
> > +     * - when the hardware init fails. (0 -> disabled)
> > +     * - encoding: unused.
> > +     * - decoding: Set by user.
> > +     */
> > +    int fallback_forbid;
> >  } AVCodecContext;
> >
> 
> This is really something user-code should implement, its easy enough
> to detect in eg. get_buffer2, and return an error from there.
> 
> - Hendrik

Thanks for your review, will modify in user-code and detect in get_buffer().

Best regards,
Linjie, Fu.


More information about the ffmpeg-devel mailing list