[FFmpeg-devel] [PATCH] Floating point exception

Reimar Döffinger Reimar.Doeffinger
Sun Dec 26 10:50:53 CET 2010


On 26 dec 2010, at 09:40, David Czech <davidczech510 at gmail.com> wrote:

>> 
>>> Yes, this is the wrong place, .den == 0 is an invalid value and a bug in
> whatever sets it to that.
>> Changing the code in ffmpeg.c means that other programs like MPlayer will
> have to add the same hack and/or will still crash.
>> It is unreasonable to expect users of libav* to check every single value
> the library returns, that would mean 100s of lines of code even >before the
> code does anything.
> 
> Yeah, I guess that makes sense (I just thought that it was checking for
> time_base.num but forgot about time_base.den).

No, num == 0 is a valid number at least, and in this case indicates "unknown".
x/0 is not a valid number and generally should never be set at all, at least not without being mentioned specifically in the documentation including the reasoning.

>  I'm completely lost in
> ffmpeg's source code, where should the fix be? Maybe some intense debugging
> might show who sets it to zero (if anyone does), but if not who should check
> it?

The demuxed in libavformat or for some codecs the codec in libavcodec (the latter is much less likely).
As an additional safeguard I guess it should be acceptable to check for such a value at some appropriate place in libavformat/utils.c, print a warning and override it to 0/1.
> 



More information about the ffmpeg-devel mailing list