[vlc-devel] [vlc-commits] decoder: remove tautology, add asserts to waiting code

Thomas Guillem thomas at gllm.fr
Fri Mar 20 13:42:13 CET 2015



On Thu, Mar 19, 2015, at 18:56, Rémi Denis-Courmont wrote:
> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Mar 18
> 23:29:30 2015 +0200| [621400186a49b282197267e588a030b425829a64] |
> committer: Rémi Denis-Courmont
> 
> decoder: remove tautology, add asserts to waiting code
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=621400186a49b282197267e588a030b425829a64
> ---
> 
>  src/input/decoder.c |   17 +++++++----------
>  1 file changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 3c8a32a..720df86 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -516,17 +516,15 @@ void input_DecoderStartWait( decoder_t *p_dec )
>  {
>      decoder_owner_sys_t *p_owner = p_dec->p_owner;
>  
> -    vlc_mutex_lock( &p_owner->lock );
> +    assert( !p_owner->b_waiting );

It asserts on android, I can't reproduce it on Desktop.

DecoderStartWait can be called more than one time from
EsOutChangePosition before input_DecoderStopWait is called.

I think the main difference with the desktop is that android port don't
wait for the seek to finish before seeking again.

>  
> +    vlc_mutex_lock( &p_owner->lock );
>      DecoderFlush( p_dec );
>  
>      p_owner->b_first = true;
>      p_owner->b_has_data = false;
> -
>      p_owner->b_waiting = true;
> -
>      vlc_cond_signal( &p_owner->wait_request );
> -
>      vlc_mutex_unlock( &p_owner->lock );
>  }
>  
> @@ -534,12 +532,11 @@ void input_DecoderStopWait( decoder_t *p_dec )
>  {
>      decoder_owner_sys_t *p_owner = p_dec->p_owner;
>  
> -    vlc_mutex_lock( &p_owner->lock );
> +    assert( p_owner->b_waiting );
>  
> +    vlc_mutex_lock( &p_owner->lock );
>      p_owner->b_waiting = false;
> -
>      vlc_cond_signal( &p_owner->wait_request );
> -
>      vlc_mutex_unlock( &p_owner->lock );
>  }
>  
> @@ -547,14 +544,14 @@ void input_DecoderWait( decoder_t *p_dec )
>  {
>      decoder_owner_sys_t *p_owner = p_dec->p_owner;
>  
> -    vlc_mutex_lock( &p_owner->lock );
> +    assert( p_owner->b_waiting );
>  
> -    while( p_owner->b_waiting && !p_owner->b_has_data )
> +    vlc_mutex_lock( &p_owner->lock );
> +    while( !p_owner->b_has_data )
>      {
>          block_FifoWake( p_owner->p_fifo );
>          vlc_cond_wait( &p_owner->wait_acknowledge, &p_owner->lock );
>      }
> -
>      vlc_mutex_unlock( &p_owner->lock );
>  }
>  
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits



More information about the vlc-devel mailing list