[vlc-devel] [PATCH]intf.c mutex conflict when switch left/right audio channel

Rémi Denis-Courmont rem at videolan.org
Fri Dec 19 20:54:56 CET 2008


The first blob looks fine, but the next ones:

>          /* Release all locks and report the error. */
> +        aout_unlock_input_fifos( p_aout );
>          for ( i = 0; i < p_aout->i_nb_inputs; i++ )
>          {
>              vlc_mutex_unlock( &p_aout->pp_inputs[i]->lock );
>          }
> -        aout_unlock_input_fifos( p_aout );
>          aout_unlock_mixer( p_aout );
>          return -1;
>      }

Hmm, I don't really see what this solves. As far as I know *un*locking 
order cannot be a cause for deadlocks. Is this an optimization or...?

> @@ -407,25 +409,27 @@ static int aout_Restart( aout_instance_t
>      if ( aout_MixerNew( p_aout ) == -1 )
>      {
>          aout_OutputDelete( p_aout );
> +        aout_unlock_input_fifos( p_aout );
>          for ( i = 0; i < p_aout->i_nb_inputs; i++ )
>          {
>              vlc_mutex_unlock( &p_aout->pp_inputs[i]->lock );
>          }
> -        aout_unlock_input_fifos( p_aout );
>          aout_unlock_mixer( p_aout );
>          return -1;
>     }

Same here.
 
> +    aout_unlock_input_fifos( p_aout );
>      /* Re-open all inputs. */
>      for ( i = 0; i < p_aout->i_nb_inputs; i++ )
>      {
> +        aout_lock_input_fifos( p_aout );
>          aout_input_t * p_input = p_aout->pp_inputs[i];
>          b_error |= aout_InputNew( p_aout, p_input,
>                                    &p_input->request_vout ); 
>          p_input->b_changed = 1;
> +        aout_unlock_input_fifos( p_aout );
>          aout_unlock_input( p_aout, p_input );
>      }
>
> -    aout_unlock_input_fifos( p_aout );

Why unlock and relock FIFOs so many times?

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



More information about the vlc-devel mailing list