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

Nicolas George george at nsup.org
Wed Nov 12 09:16:53 CET 2014


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.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141112/4d301cdc/attachment.asc>


More information about the ffmpeg-devel mailing list