[vlc-commits] hls: Trying to work arround streams without bandwidth value.

Hugo Beauzée-Luyssen git at videolan.org
Mon Jan 23 21:52:50 CET 2012


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Jan 23 15:05:33 2012 +0100| [1f33a25ef2627b2b6411610b039f217dbdc3fb2e] | committer: Jean-Baptiste Kempf

hls: Trying to work arround streams without bandwidth value.

A 0 bandwidth forbid us to seek, as the position would always be 0.
This fixes one of the problems described in #5370

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index bfcad5e..8de9638 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1558,6 +1558,11 @@ 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)
+    {
+        /* Try to estimate the bandwidth for this stream */
+        hls->bandwidth = (uint64_t)((double)segment->size / ((double)duration / 1000000.0));
+    }
 
     /* If the segment is encrypted, decode it */
     if (hls_DecodeSegmentData(s, hls, segment) != VLC_SUCCESS)



More information about the vlc-commits mailing list