[vlc-devel] [vlc-commits] stream_filter/httplive.c: signal download thread on successfull index reload (live streams)

Rémi Denis-Courmont remi at remlab.net
Mon Oct 10 14:42:41 CEST 2011


On Mon, 10 Oct 2011 14:30:01 +0200 (CEST), git at videolan.org (Jean-Paul
Saman) wrote:
> vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed
Oct 
> 5 15:48:43 2011 +0200| [176f95145a9abe736170f8e02ef94720dbf6d4d6] |
> committer: Jean-Paul Saman
> 
> stream_filter/httplive.c: signal download thread on successfull index
> reload (live streams)
> 
> Make sure the download thread will continue when an new index file for
> this stream has been successfully loaded.
> 
>>
http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=176f95145a9abe736170f8e02ef94720dbf6d4d6
> ---
> 
>  modules/stream_filter/httplive.c |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/stream_filter/httplive.c
> b/modules/stream_filter/httplive.c
> index e809a7b..a409c40 100644
> --- a/modules/stream_filter/httplive.c
> +++ b/modules/stream_filter/httplive.c
> @@ -1077,9 +1077,20 @@ static int hls_ReloadPlaylist(stream_t *s)
>              msg_Info(s, "new HLS stream appended (id=%d,
>              bandwidth=%"PRIu64")",
>                       hls_new->id, hls_new->bandwidth);
>          }
> -        else if (hls_UpdatePlaylist(s, hls_new, &hls_old) !=
VLC_SUCCESS)
> -            msg_Info(s, "failed updating HLS stream (id=%d,
> bandwidth=%"PRIu64")",
> -                     hls_new->id, hls_new->bandwidth);
> +        else
> +        {
> +            if ((hls_UpdatePlaylist(s, hls_new, &hls_old) ==
VLC_SUCCESS)
> &&
> +                    (s->p_sys->download.stream == n))
> +            {
> +                /* wake up download thread */
> +                vlc_mutex_lock(&s->p_sys->download.lock_wait);
> +                vlc_cond_signal(&s->p_sys->download.wait);
> +                vlc_mutex_unlock(&s->p_sys->download.lock_wait);

This code makes no sense under the VLC (i.e. POSIX) model of condition
variables.

There is thus 99.999% probability that there is a race condition somewhere
nearby, though I don't have time to investigate.

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



More information about the vlc-devel mailing list