vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <beauz...@gmail.com> | Mon 
Jan 23 16:45:28 2012 +0100| [d09ceb766b16c6bae737da8555c8f1297c6650fa] | 
committer: Jean-Baptiste Kempf

hls: Fixing some locks.

Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org>
(cherry picked from commit bcbad8c70e309d03ec7dac57ee1f146f41948574)

Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org>

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

 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
         {

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to