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

Thomas Guillem thomas at gllm.fr
Sat Feb 1 19:13:33 CET 2020



On Sat, Feb 1, 2020, at 18:36, zhilizhao wrote:
> 
> 
> > On Jan 31, 2020, at 9:11 PM, Thomas Guillem <thomas at gllm.fr> wrote:
> > 
> > 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
> 
> You mean stuck ‘in’ pf_decode()?

Yes

> 
> > +         * 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 )
> > -- 
> > 2.20.1
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> 
> _______________________________________________
> 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