[vlc-devel] [PATCH 3/3] decoder: fix slow video flush
Thomas Guillem
thomas at gllm.fr
Fri Nov 27 16:21:44 CET 2020
Video flush was taking between 1 seconds to 10 seconds because the flush
request was not processed by the DecoderThread that was stuck in
pf_decode() callbacks waiting for new pictures.
---
src/input/decoder.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 8d67f7ea637..94e328f040e 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1470,6 +1470,11 @@ static void DecoderThread_Flush( vlc_input_decoder_t *p_owner )
{
if( p_owner->p_vout )
vout_FlushAll( p_owner->p_vout );
+
+ /* Reset the pool cancel state, previously set by
+ * vlc_input_decoder_Flush() */
+ if( p_owner->out_pool != NULL )
+ picture_pool_Cancel( p_owner->out_pool, false );
}
else if( p_dec->fmt_out.i_cat == SPU_ES )
{
@@ -2288,6 +2293,17 @@ void vlc_input_decoder_Flush( vlc_input_decoder_t *p_owner )
vlc_fifo_Unlock( p_owner->p_fifo );
+ if ( p_owner->fmt.i_cat == VIDEO_ES )
+ {
+ /* Set the pool cancel state. This will unblock the module if it is
+ * waiting for new pictures (likely). This state will be reset back
+ * from the DecoderThread once the flush request is processed. */
+ vlc_mutex_lock( &p_owner->lock );
+ if( p_owner->out_pool != NULL )
+ picture_pool_Cancel( p_owner->out_pool, true );
+ vlc_mutex_unlock( &p_owner->lock );
+ }
+
if( p_owner->paused )
{
/* The DecoderThread could be stuck in pf_decode(). This is likely the
--
2.28.0
More information about the vlc-devel
mailing list