[FFmpeg-devel] [PATCH] use proper macro to avoid issue with prior avutil/timestamp.c

Rémi Denis-Courmont remi at remlab.net
Sat Aug 17 17:07:38 EEST 2024



Le 17 août 2024 06:09:16 GMT+03:00, Mike Lieman <mikelieman at gmail.com> a écrit :
>From b2ddfdd9ed695a1f47ed6251369abca08864e3ab Mon Sep 17 00:00:00 2001
>From: Mike Lieman <mikelieman at gmail.com>
>Date: Fri, 16 Aug 2024 23:05:51 -0400
>Subject: [PATCH] use proper macro to avoid issue with prior
>avutil/timestamp.c
> patch causing long startup times with some files under mplayer
> (https://trac.mplayerhq.hu/ticket/2425)
>
>---
> libavutil/timestamp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libavutil/timestamp.c b/libavutil/timestamp.c
>index 6c231a517d..eab2531538 100644
>--- a/libavutil/timestamp.c
>+++ b/libavutil/timestamp.c
>@@ -24,7 +24,7 @@ char *av_ts_make_time_string2(char *buf, int64_t ts,
>AVRational tb)
>         snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
>     } else {
>         double val = av_q2d(tb) * ts;
>-        double log = (fpclassify(val) == FP_ZERO ? -INFINITY :
>floor(log10(fabs(val))));
>+        double log = (fpclassify(val) == FP_ZERO ? FP_INFINITE :

You're papering over whatever the real issue is here. As noted by James and the Trac issue already, FP_INFINITE is *not* a floating point value and using it this way makes no sense.

>floor(log10(fabs(val))));
>         int precision = (isfinite(log) && log < 0) ? -log + 5 : 6;
>         int last = snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.*f", precision,
>val);
>         last = FFMIN(last, AV_TS_MAX_STRING_SIZE - 1) - 1;


More information about the ffmpeg-devel mailing list