[vlc-commits] HLS: fix error in d781f87d and simplify

Jean-Baptiste Kempf git at videolan.org
Sun Jul 29 22:39:01 CEST 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Jul 29 17:37:56 2012 +0200| [31b5a1b5b69abde1f509c9115f1f7d0ad21c604d] | committer: Jean-Baptiste Kempf

HLS: fix error in d781f87d and simplify

Close #7240

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

 modules/stream_filter/httplive.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index df185ae..6297b1f 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1280,6 +1280,7 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
     msg_Info(s, "updating hls stream (program-id=%d, bandwidth=%"PRIu64") has %d segments",
              hls_new->id, hls_new->bandwidth, count);
 
+    vlc_mutex_lock(&hls_old->lock);
     for (int n = 0; n < count; n++)
     {
         segment_t *p = segment_GetSegment(hls_new, n);
@@ -1333,7 +1334,10 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
         {
             int last = vlc_array_count(hls_old->segments) - 1;
             segment_t *l = segment_GetSegment(hls_old, last);
-            if (l == NULL) assert(0);
+            if (l == NULL) {
+                vlc_mutex_unlock(&hls_old->lock);
+                return VLC_EGENERIC;
+            }
 
             if ((l->sequence + 1) != p->sequence)
             {
@@ -1352,9 +1356,6 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
     vlc_mutex_unlock(&hls_old->lock);
     return VLC_SUCCESS;
 
-fail_and_unlock:
-    vlc_mutex_unlock(&hls_old->lock);
-    return VLC_EGENERIC;
 }
 
 static int hls_ReloadPlaylist(stream_t *s)



More information about the vlc-commits mailing list