vlc | branch: master | Frédéric Yhuel <[email protected]> | 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 <[email protected]>

> 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))
     {

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to