From d347a7b248d4ffdc278373fecf033b0ade030343 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 3 Oct 2013 01:52:37 +0300
Subject: [PATCH] ismindex: Use the individual stream duration instead of the
 global one
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The stream duration is used for calculating the duration of the
last fragment easily without manually parsing anything else than
the mfra/tfra atoms. When the global file duration was used
previously, the duration of the last fragment could end up wrong
if the streams weren't equally long.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 tools/ismindex.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/ismindex.c b/tools/ismindex.c
index cf89f5c1e12..64fa7e80c01 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -320,8 +320,7 @@ static int handle_file(struct Tracks *tracks, const char *file, int split)
         track->bitrate   = st->codec->bit_rate;
         track->track_id  = st->id;
         track->timescale = st->time_base.den;
-        track->duration  = av_rescale_rnd(ctx->duration, track->timescale,
-                                          AV_TIME_BASE, AV_ROUND_UP);
+        track->duration  = st->duration;
         track->is_audio  = st->codec->codec_type == AVMEDIA_TYPE_AUDIO;
         track->is_video  = st->codec->codec_type == AVMEDIA_TYPE_VIDEO;
 
-- 
GitLab