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

Rémi Denis-Courmont remi at remlab.net
Sun Feb 2 11:16:37 CET 2020


Can we read 'paused' without lock in this case?

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

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200202/023f1789/attachment.html>


More information about the vlc-devel mailing list