[vlc-devel] [PATCH] decoder: drop decoder output while flushing

Francois Cartegnie fcvlcdev at free.fr
Fri Oct 12 12:53:03 CEST 2018


On flush, threaded decoders or until
DecoderProcess exit, decoded data is still
output before decoder flush.

On vout, this causes incorrect first picture
received.
---
 src/input/decoder.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index b39c704bfa..023881753b 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -954,6 +954,13 @@ static void DecoderPlayCc( decoder_t *p_dec, block_t *p_cc,
 
     vlc_mutex_lock( &p_owner->lock );
 
+    if( p_owner->flushing )
+    {
+        vlc_mutex_unlock( &p_owner->lock );
+        block_Release( p_cc );
+        return;
+    }
+
     p_owner->cc.desc = *p_desc;
 
     /* Fanout data to all decoders. We do not know if es_out
@@ -1026,7 +1033,8 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
     bool prerolled;
 
     vlc_mutex_lock( &p_owner->lock );
-    if( p_owner->i_preroll_end > p_picture->date )
+    if( p_owner->flushing ||
+        p_owner->i_preroll_end > p_picture->date )
     {
         vlc_mutex_unlock( &p_owner->lock );
         picture_Release( p_picture );
@@ -1166,7 +1174,8 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
     assert( p_audio != NULL );
 
     vlc_mutex_lock( &p_owner->lock );
-    if( p_owner->i_preroll_end > p_audio->i_pts )
+    if( p_owner->flushing ||
+        p_owner->i_preroll_end > p_audio->i_pts )
     {
         vlc_mutex_unlock( &p_owner->lock );
         block_Release( p_audio );
-- 
2.17.2



More information about the vlc-devel mailing list