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

Rémi Denis-Courmont remi at remlab.net
Tue Jan 10 13:50:14 CET 2012


On Mon,  9 Jan 2012 16:16:27 +0100, Hugo Beauzée-Luyssen
<beauze.h at gmail.com> wrote:
> 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);
>      }

I have not checked the details of segment_GetSegment() but this patch
looks a lot like it is *introducing* the race condition that it claims to
fix.

>  
>      /* Was the HLS stream changed to another bitrate? */

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list