Commit 69dba1e6 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

hls: Adding missing locks.

(cherry picked from commit 348b17855b171300e0f07c81b995325d71f0b564)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent fe06664f
...@@ -2112,13 +2112,16 @@ static segment_t *GetSegment(stream_t *s) ...@@ -2112,13 +2112,16 @@ static segment_t *GetSegment(stream_t *s)
segment = segment_GetSegment(hls, p_sys->playback.segment); segment = segment_GetSegment(hls, p_sys->playback.segment);
if (segment != NULL) if (segment != NULL)
{ {
vlc_mutex_lock(&segment->lock);
/* This segment is ready? */ /* This segment is ready? */
if (segment->data != NULL) if (segment->data != NULL)
{ {
vlc_mutex_unlock(&segment->lock);
p_sys->b_cache = hls->b_cache; p_sys->b_cache = hls->b_cache;
vlc_mutex_unlock(&hls->lock); vlc_mutex_unlock(&hls->lock);
goto check; goto check;
} }
vlc_mutex_unlock(&segment->lock);
} }
vlc_mutex_unlock(&hls->lock); vlc_mutex_unlock(&hls->lock);
} }
...@@ -2144,15 +2147,18 @@ static segment_t *GetSegment(stream_t *s) ...@@ -2144,15 +2147,18 @@ static segment_t *GetSegment(stream_t *s)
int i_segment = p_sys->download.segment; int i_segment = p_sys->download.segment;
vlc_mutex_unlock(&p_sys->download.lock_wait); vlc_mutex_unlock(&p_sys->download.lock_wait);
vlc_mutex_lock(&segment->lock);
/* This segment is ready? */ /* This segment is ready? */
if ((segment->data != NULL) && if ((segment->data != NULL) &&
(p_sys->playback.segment < i_segment)) (p_sys->playback.segment < i_segment))
{ {
p_sys->playback.stream = i_stream; p_sys->playback.stream = i_stream;
p_sys->b_cache = hls->b_cache; p_sys->b_cache = hls->b_cache;
vlc_mutex_unlock(&segment->lock);
vlc_mutex_unlock(&hls->lock); vlc_mutex_unlock(&hls->lock);
goto check; goto check;
} }
vlc_mutex_unlock(&segment->lock);
vlc_mutex_unlock(&hls->lock); vlc_mutex_unlock(&hls->lock);
if (!p_sys->b_meta) if (!p_sys->b_meta)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment