summaryrefslogtreecommitdiff
path: root/libavformat/hls.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-22 19:36:33 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-22 19:36:33 +0200
commit419a3d8a43d2047ae5339895943fb8926eaa6f8c (patch)
tree0430b6fe59051bcfcb6d27d4b868616e1e605da8 /libavformat/hls.c
parent2a5891bb9dfe55145a2f7dc9bcea8dbeaf2abc5f (diff)
avformat/hls: avoid floating point arithmetic
Should make things more reproducable across platforms Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r--libavformat/hls.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 995dc9fa87..355f1a6b16 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -524,10 +524,10 @@ static int hls_read_header(AVFormatContext *s)
/* If this isn't a live stream, calculate the total duration of the
* stream. */
if (c->variants[0]->finished) {
- double duration = 0.0;
+ int64_t duration = 0;
for (i = 0; i < c->variants[0]->n_segments; i++)
- duration += c->variants[0]->segments[i]->duration;
- s->duration = duration * AV_TIME_BASE;
+ duration += round(c->variants[0]->segments[i]->duration * AV_TIME_BASE);
+ s->duration = duration;
}
/* Open the demuxer for each variant */