[vlc-devel] [PATCH] decoder: don't flush if already flushed

Thomas Guillem thomas at gllm.fr
Mon Nov 9 18:55:01 CET 2015


This commit fixes the following assert in the DecoderThread function:
"assert( vlc_fifo_IsEmpty( p_owner->p_fifo) );"

Indeed, if input_DecoderFlush is called again (just after), p_owner->flushed
will be true and the input won't wait for the DecoderThread. As a consequence,
the input will send blocks while the DecoderThread is flushing, hence the
assert.
---
 src/input/decoder.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 8da034a..cacf7f2 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1873,6 +1873,14 @@ void input_DecoderFlush( decoder_t *p_dec )
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
     vlc_fifo_Lock( p_owner->p_fifo );
+
+    /* Don't flush if already flushed */
+    if( p_owner->flushed )
+    {
+        vlc_fifo_Unlock( p_owner->p_fifo );
+        return;
+    }
+
     /* Empty the fifo */
     block_ChainRelease( vlc_fifo_DequeueAllUnlocked( p_owner->p_fifo ) );
     p_owner->flushing = true;
-- 
2.1.4



More information about the vlc-devel mailing list