[vlc-devel] [PATCH] decoder: read the old p_aout in the lock where we reset it
Thomas Guillem
thomas at gllm.fr
Tue Sep 3 11:36:59 CEST 2019
Nothing against it. I also like the old way since it tells me that the current thread own the output variable.
On Tue, Sep 3, 2019, at 11:30, Steve Lhomme wrote:
> It's already done this way for p_vout. Since we're going to lock for writing,
> we might as well read the value in that lock.
> ---
> src/input/decoder.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 63f858c397..25aa1e0727 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -220,9 +220,9 @@ static int ReloadDecoder( struct decoder_owner
> *p_owner, bool b_packetizer,
> if( reload == RELOAD_DECODER_AOUT )
> {
> assert( p_owner->fmt.i_cat == AUDIO_ES );
> - audio_output_t *p_aout = p_owner->p_aout;
>
> vlc_mutex_lock( &p_owner->lock );
> + audio_output_t *p_aout = p_owner->p_aout;
> p_owner->p_aout = NULL;
> vlc_mutex_unlock( &p_owner->lock );
> if( p_aout )
> @@ -301,10 +301,9 @@ static int aout_update_format( decoder_t *p_dec )
> p_dec->fmt_out.i_codec != p_dec->fmt_out.audio.i_format ||
> p_dec->fmt_out.i_profile != p_owner->fmt.i_profile ) )
> {
> - audio_output_t *p_aout = p_owner->p_aout;
> -
> /* Parameters changed, restart the aout */
> vlc_mutex_lock( &p_owner->lock );
> + audio_output_t *p_aout = p_owner->p_aout;
> p_owner->p_aout = NULL;
> vlc_mutex_unlock( &p_owner->lock );
> aout_DecDelete( p_aout );
> --
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list