[FFmpeg-devel] [PATCH] use proper macro to avoid issue with prior avutil/timestamp.c
James Almer
jamrial at gmail.com
Sat Aug 17 06:31:59 EEST 2024
On 8/17/2024 12:09 AM, Mike Lieman wrote:
> 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 :
FP_INFINITE is a return value from fpclassify(), not a double.
Does maybe using av_int2double(UINT64_C(0xFFF) << 52) help your slow
startup?
> 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