[vlc-devel] [PATCH 18/48] hls: Add missing lock segment ready

Hugo Beauzée-Luyssen beauze.h at gmail.com
Mon Jan 9 16:16:27 CET 2012


From: Luc Saillard <luc.saillard at sfr.com>

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

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index a7089b6..606f2f4 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -2103,17 +2103,19 @@ static segment_t *GetSegment(stream_t *s)
     {
         vlc_mutex_lock(&hls->lock);
         segment = segment_GetSegment(hls, p_sys->playback.segment);
+        vlc_mutex_unlock(&hls->lock);
         if (segment != NULL)
         {
             /* This segment is ready? */
+            vlc_mutex_lock(&segment->lock);
             if (segment->data != NULL)
             {
                 p_sys->b_cache = hls->b_cache;
-                vlc_mutex_unlock(&hls->lock);
+                vlc_mutex_unlock(&segment->lock);
                 goto check;
             }
+            vlc_mutex_unlock(&segment->lock);
         }
-        vlc_mutex_unlock(&hls->lock);
     }
 
     /* Was the HLS stream changed to another bitrate? */
-- 
1.7.8.3




More information about the vlc-devel mailing list