[vlc-devel] [PATCH] input: fix crash when flushing the decoder

Felix Abecassis felix.abecassis at gmail.com
Mon Aug 11 11:56:42 CEST 2014


The crash can occur in the following situation:
1) A video decoder is created and starts waiting for the first picture:
   b_waiting = true, b_first = true

2) The first picture is received but the decoder is still in waiting mode:
   b_waiting = true, b_first = false

3) A second picture is received, the decoder is now waiting in
DecoderWaitUnblock().

4) From the input thread, an EOF event is received, EsOutChangePosition is
called and sets the decoder in flushing mode.

5) The decoder thread wakes up and exits DecoderWaitUnblock because
b_flushing is true. However this triggers the assertion in
DecoderDecodeVideo since we have b_waiting && !b_first.
---
 src/input/decoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 87c65ef..7b8f585 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1326,7 +1326,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
 
     bool b_reject = DecoderWaitUnblock( p_dec );
 
-    if( p_owner->b_waiting )
+    if( !b_reject && p_owner->b_waiting )
     {
         assert( p_owner->b_first );
         msg_Dbg( p_dec, "Received first picture" );
-- 
1.9.1




More information about the vlc-devel mailing list