vlc | branch: master | Thomas Guillem <[email protected]> | Fri Dec 11 11:59:24 
2015 +0100| [3532e72eb51586fd61b97faae1efc96a39c79b4d] | committer: Thomas 
Guillem

avcodec: abort pictures when flushing

This fixes a deadlock when seeking paused. It happened when avcodec needed more
pictures than VLC. It was easily reproducible with h264 in a TS file.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3532e72eb51586fd61b97faae1efc96a39c79b4d
---

 modules/codec/avcodec/video.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 202964e..6310f84 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -507,9 +507,17 @@ static void Flush( decoder_t *p_dec )
     p_sys->i_pts = VLC_TS_INVALID; /* To make sure we recover properly */
     p_sys->i_late_frames = 0;
 
+    /* Abort pictures in order to unblock all avcodec workers threads waiting
+     * for a picture. This will avoid a deadlock between avcodec_flush_buffers
+     * and workers threads */
+    decoder_AbortPictures( p_dec, true );
+
     post_mt( p_sys );
     avcodec_flush_buffers( p_context );
     wait_mt( p_sys );
+
+    /* Reset cancel state to false */
+    decoder_AbortPictures( p_dec, false );
 }
 
 /*****************************************************************************

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to