[vlc-commits] hls: Fixing some locks.

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


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Jan 23 16:45:28 2012 +0100| [bcbad8c70e309d03ec7dac57ee1f146f41948574] | committer: Jean-Baptiste Kempf

hls: Fixing some locks.

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

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

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

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 458d338..76e6093 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1360,11 +1360,11 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
         segment_t *segment = segment_Find(*hls, p->sequence);
         if (segment)
         {
+            vlc_mutex_lock(&segment->lock);
+
             assert(p->url.psz_path);
             assert(segment->url.psz_path);
 
-            vlc_mutex_lock(&segment->lock);
-
             /* they should be the same */
             if ((p->sequence != segment->sequence) ||
                 (p->duration != segment->duration) ||
@@ -1382,6 +1382,7 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
                 {
                     msg_Err(s, "Failed updating segment %d - skipping it",  p->sequence);
                     segment_Free(p);
+                    vlc_mutex_unlock(&segment->lock);
                     continue;
                 }
                 segment->sequence = p->sequence;
@@ -1396,11 +1397,10 @@ static int hls_UpdatePlaylist(stream_t *s, hls_stream_t *hls_new, hls_stream_t *
                 }
                 free(segment->psz_key_path);
                 segment->psz_key_path = p->psz_key_path ? strdup(p->psz_key_path) : NULL;
+                vlc_mutex_unlock(&segment->lock);
                 segment_Free(p);
                 free(psz_url);
             }
-
-            vlc_mutex_unlock(&segment->lock);
         }
         else
         {



More information about the vlc-commits mailing list