From 9b56d51f92d195c670dab414da59fc4b8f9ac566 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sun, 1 Nov 2009 12:51:50 +0100 Subject: [PATCH] Avoid divide-by-zero for files with duration < AV_TIME_BASE --- src/filescanner_ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filescanner_ffmpeg.c b/src/filescanner_ffmpeg.c index 8e6680bd..a6903b8d 100644 --- a/src/filescanner_ffmpeg.c +++ b/src/filescanner_ffmpeg.c @@ -165,7 +165,7 @@ scan_metadata_ffmpeg(char *file, struct media_file_info *mfi) if (ctx->bit_rate > 0) mfi->bitrate = ctx->bit_rate / 1000; - else if (ctx->duration > 0) /* guesstimate */ + else if (ctx->duration > AV_TIME_BASE) /* guesstimate */ mfi->bitrate = ((mfi->file_size * 8) / (ctx->duration / AV_TIME_BASE)) / 1000; DPRINTF(E_DBG, L_SCAN, "Duration %d ms, bitrate %d kbps\n", mfi->song_length, mfi->bitrate);