[vlc-devel] [PATCH] playlist: prevent playing an invalid playlist indefinitely

Rémi Denis-Courmont remi at remlab.net
Wed Feb 24 21:02:00 CET 2016


Le 2016-02-24 07:16, Zhao Zhili a écrit :
> ---
>  src/playlist/thread.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/playlist/thread.c b/src/playlist/thread.c
> index a348479..21bb090 100644
> --- a/src/playlist/thread.c
> +++ b/src/playlist/thread.c
> @@ -498,6 +498,8 @@ static void *Thread ( void *data )
>              continue;
>          }
>  
> +        int count = 0;
> +        mtime_t i_time = 0;
>          while( !p_sys->killed && Next( p_playlist ) )
>          {   /* Playlist in running state */
>              assert(p_sys->p_input != NULL);
> @@ -505,6 +507,18 @@ static void *Thread ( void *data )
>              do
>                  LoopInput( p_playlist );
>              while( p_sys->p_input != NULL );
> +
> +            /* prevent playing an invalid playlist
> indefinitely */
> +            if( mdate() - i_time < 500000 )
> +            {
> +                count++;
> +                if( count > p_playlist->current.i_size
> )
> +                    break;
> +            }

On the one hand, there could be just one valid item of a few hundred 
milliseconds in the playlist (e.g. alarm sound). On the other hand, 
there could be thousands of items in the playlist all invalid.

This patch breaks the first use case, and fails to fix the second one.

> +            else
> +                count = 0;
> +
> +            i_time = mdate();
>          }
>  
>          msg_Dbg( p_playlist, "nothing to play" );

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


More information about the vlc-devel mailing list