[vlc-devel] [PATCH] input: decoder: fix audio GET_EMPTY mid stream

Francois Cartegnie fcvlcdev at free.fr
Wed Jun 28 19:06:53 CEST 2017


When the demuxer does not reach EOS, the decoders
are not drained and GET_EMPTY can't succeed for
audio as it is in idle/fifo wait state.
Note: The caller knows the fifo won't receive any
further data until GET_EMPTY succeeds.

refs #18463
---
 src/input/decoder.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 0a96c04..73c7a29 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -2092,7 +2092,16 @@ bool input_DecoderIsEmpty( decoder_t * p_dec )
     if( p_owner->fmt.i_cat == VIDEO_ES && p_owner->p_vout != NULL )
         b_empty = vout_IsEmpty( p_owner->p_vout );
     else if( p_owner->fmt.i_cat == AUDIO_ES )
+    {
         b_empty = atomic_load( &p_owner->drained );
+        if( !b_empty )
+        {
+            vlc_fifo_Lock( p_owner->p_fifo );
+            if( !p_owner->b_draining )
+                b_empty |= vlc_fifo_IsEmpty( p_owner->p_fifo );
+            vlc_fifo_Unlock( p_owner->p_fifo );
+        }
+    }
     else
         b_empty = true; /* TODO subtitles support */
     vlc_mutex_unlock( &p_owner->lock );
-- 
2.9.4



More information about the vlc-devel mailing list