[vlc-commits] stream_filter/httplive.c: Various bandwidth fixes
Hugo Beauzée-Luyssen
git at videolan.org
Tue Jan 24 19:31:54 CET 2012
vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <chouquette at videolan.org> | Wed Jan 18 17:22:08 2012 +0100| [cee57477b7da3a961706ea7f7b993bebbdfb7e4e] | committer: Jean-Baptiste Kempf
stream_filter/httplive.c: Various bandwidth fixes
- Bandwidth is an unsigned int in hls_New(), so initiliaze it to 0 iso -1.
- Do not calculate StreamSIze if bandwidth is not known, yet.
Signed-off-by: Jean-Paul Saman <jean-paul.saman at m2x.nl>
(cherry picked from commit be906d5275337481ac30469a839a10fa72f39786)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=cee57477b7da3a961706ea7f7b993bebbdfb7e4e
---
modules/stream_filter/httplive.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 8038e36..cb660ef 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -314,6 +314,12 @@ static uint64_t hls_GetStreamSize(hls_stream_t *hls)
* then the deviation from exact byte size will be big and the seek/
* progressbar will not behave entirely as one expects. */
uint64_t size = 0UL;
+
+ /* If there is no valid bandwidth yet, then there is no point in
+ * computing stream size. */
+ if (hls->bandwidth == 0)
+ return size;
+
int count = vlc_array_count(hls->segments);
for (int n = 0; n < count; n++)
{
@@ -968,7 +974,7 @@ static int parse_M3U8(stream_t *s, vlc_array_t *streams, uint8_t *buffer, const
else
{
/* No Meta playlist used */
- hls = hls_New(streams, 0, -1, NULL);
+ hls = hls_New(streams, 0, 0, NULL);
if (hls)
{
/* Get TARGET-DURATION first */
@@ -2119,6 +2125,8 @@ static uint64_t GetStreamSize(stream_t *s)
if (hls == NULL) return 0;
vlc_mutex_lock(&hls->lock);
+ if (hls->size == 0)
+ hls->size = hls_GetStreamSize(hls);
uint64_t size = hls->size;
vlc_mutex_unlock(&hls->lock);
More information about the vlc-commits
mailing list