]> git.sesse.net Git - vlc/commitdiff
input: waiting and flushing states should be mutually exclusive
authorFelix Abecassis <felix.abecassis@gmail.com>
Tue, 2 Sep 2014 09:00:23 +0000 (11:00 +0200)
committerFelix Abecassis <felix.abecassis@gmail.com>
Tue, 2 Sep 2014 09:49:22 +0000 (11:49 +0200)
A crash could 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.

Fix #11892, #12041

src/input/decoder.c

index bbcfcf89c55b6d110ab4f01736aa5fe384954c3b..d40c7d31259f406d9fa2a430f15d9367acf1d04e 100644 (file)
@@ -946,6 +946,7 @@ static void DecoderFlush( decoder_t *p_dec )
     /* Empty the fifo */
     block_FifoEmpty( p_owner->p_fifo );
 
+    p_owner->b_waiting = false;
     /* Monitor for flush end */
     p_owner->b_flushing = true;
     vlc_cond_signal( &p_owner->wait_request );