[FFmpeg-devel] [PATCH v2 1/2] avutil/timestamp: introduce av_ts_make_time_string2 for better precision
Hendrik Leppkes
h.leppkes at gmail.com
Mon Jun 17 23:08:08 EEST 2024
On Sat, Mar 23, 2024 at 12:14 PM Marton Balint <cus at passwd.hu> wrote:
> +char *av_ts_make_time_string2(char *buf, int64_t ts, AVRational tb)
> +{
> + if (ts == AV_NOPTS_VALUE) {
> + snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
> + } else {
> + double val = av_q2d(tb) * ts;
> + double log = floor(log10(fabs(val)));
This causes a floating point exception on some systems (div by zero)
if val ends up zero. Can we introduce a check to avoid the FPE?
log10(0) seems to be implementation defined, and may raise a FPE,
which we should avoid.
- Hendrik
More information about the ffmpeg-devel
mailing list