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

Hugo Beauzée-Luyssen git at videolan.org
Tue Jan 24 19:31:55 CET 2012


vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Jan 23 15:05:33 2012 +0100| [4093516cbbed3c7a718f1ea32ce223d079a261eb] | 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>
(cherry picked from commit 1f33a25ef2627b2b6411610b039f217dbdc3fb2e)

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

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

 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