[FFmpeg-devel] [PATCH 1/9] lavu/opt: introduce av_opt_is_set_to_default()

Lukasz Marek lukasz.m.luki2 at gmail.com
Wed Nov 12 14:25:41 CET 2014

On 12 November 2014 09:16, Nicolas George <george at nsup.org> wrote:

> Le primidi 21 brumaire, an CCXXIII, Lukasz Marek a écrit :
> > I dont agree. Assert cannot be placed. Return value is not checked
> > is set_defaults so errors are ignored. It can just leave invalid
> > value. Assert here would terminate an application. In general I
> > think it is not regular case - i doub't there is any option with
> > invalid default -  but all the best we can do is to compare set
> > value with the default, not validate the default
> If a default value hardcoded in FFmpeg's options table has an invalid
> default, that is a BUG in FFmpeg, a bug that needs fixing immediately; but
> fortunately a bug that is easy to fix.
> That is exactly what asserts are for: detect easy bugs as early as possible
> and get them fixed immediately.
> It would be different if the value came from outside or if the call could
> fail for external reasons (ENOMEM for example), but that is not the case
> here.

Yes, I don't deny it. But to make it sense assertion should be placed in
av_opt_set_defaults too.
(not necessarily in that function, maybe in called functions)

More information about the ffmpeg-devel mailing list