[vlc-commits] commit: stream_filter/httplive.c: NexSegment() look for next segment in *any* of the hls_stream_t's. (Jean-Paul Saman )

git at videolan.org git at videolan.org
Fri Nov 26 16:55:14 CET 2010


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Nov 24 10:10:51 2010 +0100| [ccaec9e6804b3910d5ada87955db4b5da2b82dcb] | committer: Jean-Paul Saman 

stream_filter/httplive.c: NexSegment() look for next segment in *any* of the hls_stream_t's.

NextSegment() assumed that the download thread its hls_stream_t was leading.
However this was too simplistic.

NextSegment() seeks the segment in *any* of the hls_stream_t, assuming that
each segment will be downloaded only once.

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

 modules/stream_filter/httplive.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 8f052a4..39d9fc2 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1232,11 +1232,12 @@ static segment_t *NextSegment(stream_t *s)
 {
     stream_sys_t *p_sys = s->p_sys;
     segment_t *segment = NULL;
+    int i_stream = 0;
 
     while(vlc_object_alive(s))
     {
         /* Is the next segment ready */
-        hls_stream_t *hls = hls_Get(p_sys->hls_stream, p_sys->current);
+        hls_stream_t *hls = hls_Get(p_sys->hls_stream, i_stream);
         if (hls == NULL) return NULL;
 
         segment = segment_GetSegment(hls, p_sys->segment);
@@ -1249,22 +1250,14 @@ static segment_t *NextSegment(stream_t *s)
         if (!p_sys->b_meta) return NULL;
 
         /* Was the stream changed to another bitrate? */
-        if (p_sys->current != p_sys->thread->current)
-        {
-            /* YES it was */
-            msg_Info(s, "playback is switching from stream %d to %d",
-                     p_sys->current, p_sys->thread->current);
-            p_sys->current = p_sys->thread->current;
-            continue;
-        }
-
+        i_stream++;
+        if (i_stream >= vlc_array_count(p_sys->hls_stream))
+            return NULL;
 #if 0
-        /* Not downloaded yet, do it here */
-        if (Download(s, hls, segment, &p_sys->current) != VLC_SUCCESS)
-            return segment;
-        else
+        msg_Info(s, "playback is switching from stream %d to %d",
+                 p_sys->current, i_stream);
 #endif
-            return NULL;
+        p_sys->current = i_stream;
     }
 
     return segment;



More information about the vlc-commits mailing list