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

Mike Lieman mikelieman at gmail.com
Sat Aug 17 17:52:19 EEST 2024


I  now understand that and am trying to work through the logic to see why
we are getting this strange behaviour.    When I have some free time, I
think I'm going to have to step through this with gdb since without the
context of what's actually in buf, ts, and tb I can't understand what's
going on in the for loops, but it seems something's going on in the for
loops, since it's not happening when I'm using the incorrect constant.

On Sat, Aug 17, 2024 at 10:07 AM Rémi Denis-Courmont <remi at remlab.net>
wrote:

>
>
> 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;
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list