Commit 419a3d8a authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/hls: avoid floating point arithmetic

Should make things more reproducable across platforms
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 2a5891bb
...@@ -524,10 +524,10 @@ static int hls_read_header(AVFormatContext *s) ...@@ -524,10 +524,10 @@ static int hls_read_header(AVFormatContext *s)
/* If this isn't a live stream, calculate the total duration of the /* If this isn't a live stream, calculate the total duration of the
* stream. */ * stream. */
if (c->variants[0]->finished) { if (c->variants[0]->finished) {
double duration = 0.0; int64_t duration = 0;
for (i = 0; i < c->variants[0]->n_segments; i++) for (i = 0; i < c->variants[0]->n_segments; i++)
duration += c->variants[0]->segments[i]->duration; duration += round(c->variants[0]->segments[i]->duration * AV_TIME_BASE);
s->duration = duration * AV_TIME_BASE; s->duration = duration;
} }
/* Open the demuxer for each variant */ /* Open the demuxer for each variant */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment