[vlc-commits] hls: Adding missing locks.

Hugo Beauzée-Luyssen git at videolan.org
Wed Feb 8 18:17:02 CET 2012


vlc/vlc-2.0 | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Jan 25 15:19:35 2012 +0100| [69dba1e6e615b38a8680c90e6d50d244dda93113] | committer: Jean-Baptiste Kempf

hls: Adding missing locks.
(cherry picked from commit 348b17855b171300e0f07c81b995325d71f0b564)

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

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

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

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 21923dd..23d5b6b 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -2112,13 +2112,16 @@ static segment_t *GetSegment(stream_t *s)
         segment = segment_GetSegment(hls, p_sys->playback.segment);
         if (segment != NULL)
         {
+            vlc_mutex_lock(&segment->lock);
             /* This segment is ready? */
             if (segment->data != NULL)
             {
+                vlc_mutex_unlock(&segment->lock);
                 p_sys->b_cache = hls->b_cache;
                 vlc_mutex_unlock(&hls->lock);
                 goto check;
             }
+            vlc_mutex_unlock(&segment->lock);
         }
         vlc_mutex_unlock(&hls->lock);
     }
@@ -2144,15 +2147,18 @@ static segment_t *GetSegment(stream_t *s)
         int i_segment = p_sys->download.segment;
         vlc_mutex_unlock(&p_sys->download.lock_wait);
 
+        vlc_mutex_lock(&segment->lock);
         /* This segment is ready? */
         if ((segment->data != NULL) &&
             (p_sys->playback.segment < i_segment))
         {
             p_sys->playback.stream = i_stream;
             p_sys->b_cache = hls->b_cache;
+            vlc_mutex_unlock(&segment->lock);
             vlc_mutex_unlock(&hls->lock);
             goto check;
         }
+        vlc_mutex_unlock(&segment->lock);
         vlc_mutex_unlock(&hls->lock);
 
         if (!p_sys->b_meta)



More information about the vlc-commits mailing list