[vlc-devel] [PATCH 1/2] decoder: fix flush while paused with some async decoders

Thomas Guillem thomas at gllm.fr
Sun Feb 2 11:32:06 CET 2020



On Sun, Feb 2, 2020, at 11:16, Rémi Denis-Courmont wrote:
> Can we read 'paused' without lock in this case?

Yes we wan, and it's already done like that. The extra lock is only needed to get the vout, and acquired only when flushing paused. 

> 
> Le 31 janvier 2020 14:11:19 GMT+01:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>> cf. comment. src/input/decoder.c | 20 ++++++++++++++++++++
>>  1 file changed, 20 insertions(+)
>> 
>> diff --git a/src/input/decoder.c b/src/input/decoder.c
>> index 251be905926..1d90e60e200 100644
>> --- a/src/input/decoder.c
>> +++ b/src/input/decoder.c
>> @@ -2337,6 +2337,26 @@ void input_DecoderFlush( decoder_t *p_dec )
>>      vlc_fifo_Signal( p_owner->p_fifo );
>>  
>>      vlc_fifo_Unlock( p_owner->p_fifo );
>> +
>> +    if( p_owner->paused )
>> +    {
>> +        /* The DecoderThread could be stuck if pf_decode(). This is likely the
>> +         * case with paused asynchronous decoder modules that have a limited
>> +         * input and output pool size. Indeed, with such decoders, you have to
>> +         * release an output buffer to get an input buffer. So, when paused and
>> +         * flushed, the DecoderThread could be waiting for an output buffer to
>> +         * be released (or rendered). In that case, the DecoderThread will
>> +         * never be flushed since it be never leave pf_decode(). To fix this
>> +         * issue, pre-flush the vout from here. The vout will have to be
>> +         * flushed again since the module could be outputting more buffers just
>> +         * after being unstuck. */
>> +
>> +        vlc_mutex_lock( &p_owner->lock );
>> +        if( p_dec->fmt_out.i_cat == VIDEO_ES
>> +         && p_owner->p_vout && p_owner->vout_thread_started )
>> +            vout_FlushAll( p_owner->p_vout );
>> +        vlc_mutex_unlock( &p_owner->lock );
>> +    }
>>  }
>>  
>>  void input_DecoderGetCcDesc( decoder_t *p_dec, decoder_cc_desc_t *p_desc )
> 
> -- 
> 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/20200202/9eb5c6f8/attachment.html>


More information about the vlc-devel mailing list