[vlc-commits] HLS: don't use floats when not necessary
Frédéric Yhuel
git at videolan.org
Thu Apr 5 22:49:30 CEST 2012
vlc/vlc-2.0 | branch: master | Frédéric Yhuel <fyhuel at viotech.net> | Mon Apr 2 21:11:37 2012 +0200| [011d14cf88f486382ce486e1933dc028bbb13b2c] | committer: Jean-Baptiste Kempf
HLS: don't use floats when not necessary
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 0ef7876bbdfb9166a414fb057851aac535119122)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=011d14cf88f486382ce486e1933dc028bbb13b2c
---
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 089b6ea..d54f42f 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