[FFmpeg-devel] [PATCH] Check codec_whitelist before reinitializing AVCtx.priv_data.

Cameron Gutman aicommander at gmail.com
Sat Oct 12 02:59:09 EEST 2024


On Sun, Sep 1, 2024 at 5:43 AM Anton Khirnov <anton at khirnov.net> wrote:
>
> Quoting Dale Curtis (2024-08-01 01:18:14)
> > diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
> > index 214dca4566..f189263ff9 100644
> > --- a/libavcodec/avcodec.c
> > +++ b/libavcodec/avcodec.c
> > @@ -174,6 +174,14 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
> >      if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)
> >          return AVERROR(EINVAL);
> >
> > +    if ((ret = av_opt_set_dict(avctx, options)) < 0)
> > +        return AVERROR(EINVAL);
>
> Should be return ret;
>
> Pushed with that change and a reworded commit message to make it clearer
> what the issue is.
>
> Sorry for the delay.
>

This change caused a codec options regression in FFmpeg 7.1 because we're
now matching the provided options against the AVCodecContext options list
_before_ the codec's options list. This breaks codec options that overlap
with AVCodecContext option names (NVENC's "delay", AMF's "skip_frame", and
the codec-specific "profile" and "level" options that many encoders have).

Can we just check for "codec_whitelist" instead of applying the entire set
of options here?


More information about the ffmpeg-devel mailing list