[vlc-commits] hls: Fixing bad length computing.

Chris Smowton git at videolan.org
Sun Mar 4 22:19:16 CET 2012


vlc | branch: master | Chris Smowton <chris at smowton.net> | Sun Mar  4 22:17:33 2012 +0100| [d0590ad182d82c5c856b8b4555bce93d5ccc1fb6] | committer: Hugo Beauzée-Luyssen

hls: Fixing bad length computing.

Signed-off-by: Hugo Beauzée-Luyssen <beauze.h at gmail.com>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d0590ad182d82c5c856b8b4555bce93d5ccc1fb6
---

 modules/stream_filter/httplive.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 0bfed93..7e8c558 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -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 */



More information about the vlc-commits mailing list