[FFmpeg-devel] [PATCH] Fix floating point exception computing duration when no time-base is set

Reimar Döffinger Reimar.Doeffinger
Mon Sep 14 23:19:09 CEST 2009


On Mon, Sep 14, 2009 at 02:02:23PM -0700, Art Clarke wrote:
> The only other work around I thought of was in our code prior to each
> call of av_read_frame, iterate through all current
> AVFormatContext->streams and check for invalid time-bases, and then
> throw an error if AVCodecContext->sample_rate > 0 but
> AVStream->time_base is invalid. But this puts a bigger performance
> penalty on our "well behaving" users than the two integer check
> approach I submitted.

Uh, why not check that in whatever place sample_rate gets set (your
users don't have direct access to AVCodecContext after all, do they?)

> Plus the patch I submitted allows users to
> detect a problem has occurred and correct (e.g. if they read an audio
> packet, but duration is 0, they know that something went wrong),
> whereas the current code doesn't let people writing libraries using
> libavformat to recover from this.

That sounds like a very unlikely scenario to me, seems more likely that
nothing bad happens so they think everything is ok and silently create
broken files. And I'm not even going into writing a signal handler to
deal with it, though that definitely is _possible_, too...



More information about the ffmpeg-devel mailing list