[vlc-devel] [PATCH] dec: lock p_vout/p_aout when read from the DecoderThread
Thomas Guillem
thomas at gllm.fr
Thu May 17 15:27:02 CEST 2018
On Thu, May 17, 2018, at 15:11, Rémi Denis-Courmont wrote:
> I agree that there is a problem at least in principles, but this seems
> too naive solution.>
> For instance, aout does not allow queuing while paused.
I don't think we have asynchronous audio decoders yet.
The problem is mainly for the vout and asynchronous video decoders.
For 4.0: I think the input/decoder.c should initialize its vout/aout
during the creation (from the ressource manager). Both vout/aout should
be reconfigurable (that is already the case for aout) and stay const
during the lifetime of the decoder.
This current issue will be fixed by this solution then.
>
> Le 17 mai 2018 16:06:32 GMT+03:00, Thomas Guillem <thomas at gllm.fr>
> a écrit :>> Since these variables can be written from any thread from
>> format_update()
>>>> callbacks.
>>
>> ---
>>
>> src/input/decoder.c | 10 +++++++---
>>
>> 1 file changed, 7 insertions(+), 3 deletions(-)
>>
>>
>>
>> diff --git a/src/input/decoder.c b/src/input/decoder.c
>>
>> index 1fdc4fb7ed..f80a799723 100644
>>
>> --- a/src/input/decoder.c
>>
>> +++ b/src/input/decoder.c
>>
>> @@ -103,10 +103,10 @@ struct decoder_owner
>>
>> vlc_cond_t wait_fifo; /* TODO: merge with wait_acknowledge */
>>>> vlc_cond_t wait_timed;
>>
>>
>>
>> - /* -- These variables need locking on write(only) -- */
>>
>> + /* These variables are written from the format_update()
>> callbacks threads.
>>>> + * They need locking when they are read from the DecoderThread.
>> */
>>>> audio_output_t *p_aout;
>>
>> -
>>
>> - vout_thread_t *p_vout;
>>
>> + vout_thread_t *p_vout;
>>
>>
>>
>> /* -- Theses variables need locking on read *and* write -- */
>>>> /* Preroll */
>>
>> @@ -1535,6 +1535,7 @@ static void *DecoderThread( void *p_data )
>>>>
>>
>> /* NOTE: Only the audio and video outputs care about
>> pause. */
>>>> msg_Dbg( p_dec, "toggling %s", paused ? "resume" :
>> "pause" );
>>>> + vlc_mutex_lock( &p_owner->lock );
>>
>> switch( p_dec->fmt_out.i_cat )
>>
>> {
>>
>> case VIDEO_ES:
>>
>> @@ -1550,6 +1551,7 @@ static void *DecoderThread( void *p_data )
>>>> default:
>>
>> vlc_assert_unreachable();
>>
>> }
>>
>> + vlc_mutex_unlock( &p_owner->lock );
>>
>>
>>
>> vlc_restorecancel( canc );
>>
>> vlc_fifo_Lock( p_owner->p_fifo );
>>
>> @@ -1569,8 +1571,10 @@ static void *DecoderThread( void *p_data )
>>>> case VIDEO_ES:
>>
>> break;
>>
>> case AUDIO_ES:
>>
>> + vlc_mutex_lock( &p_owner->lock );
>>
>> if( p_owner->p_aout != NULL )
>>
>> aout_DecChangeRate( p_owner->p_aout, rate );
>>>> + vlc_mutex_unlock( &p_owner->lock );
>>
>> break;
>>
>> case SPU_ES:
>>
>> break;
>>
>
> --
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
> excuser ma brièveté.> _________________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180517/ae9cfc33/attachment.html>
More information about the vlc-devel
mailing list