Commit e9bbfae4 authored by Chris Smowton's avatar Chris Smowton Committed by Jean-Baptiste Kempf

hls: Fixing bad length computing.

Signed-off-by: default avatarHugo Beauzée-Luyssen <beauze.h@gmail.com>
(cherry picked from commit d0590ad182d82c5c856b8b4555bce93d5ccc1fb6)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent a8a12cbd
......@@ -1458,10 +1458,10 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se
return VLC_EGENERIC;
}
mtime_t duration = mdate() - start;
if (hls->bandwidth == 0)
if (hls->bandwidth == 0 && segment->duration > 0)
{
/* Try to estimate the bandwidth for this stream */
hls->bandwidth = (uint64_t)((double)segment->size / ((double)duration / 1000000.0));
hls->bandwidth = (uint64_t)(((double)segment->size * 8) / ((double)segment->duration));
}
/* If the segment is encrypted, decode it */
......
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