[vlc-commits] HLS: don't use floats when not necessary
Frédéric Yhuel
git at videolan.org
Thu Apr 5 12:47:49 CEST 2012
vlc | branch: master | Frédéric Yhuel <fyhuel at viotech.net> | Mon Apr 2 21:11:37 2012 +0200| [0ef7876bbdfb9166a414fb057851aac535119122] | committer: Jean-Baptiste Kempf
HLS: don't use floats when not necessary
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0ef7876bbdfb9166a414fb057851aac535119122
---
modules/stream_filter/httplive.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 26f6d74..433dca0 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1494,12 +1494,7 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se
msg_Info(s, "downloaded segment %d from stream %d",
segment->sequence, *cur_stream);
- /* check for division by zero */
- double ms = (double)duration / 1000.0; /* ms */
- if (ms <= 0.0)
- return VLC_SUCCESS;
-
- uint64_t bw = ((double)(segment->size * 8) / ms) * 1000; /* bits / s */
+ uint64_t bw = segment->size * 8 * 1000000 / __MAX(1, duration); /* bits / s */
p_sys->bandwidth = bw;
if (p_sys->b_meta && (hls->bandwidth != bw))
{
More information about the vlc-commits
mailing list