Commit 3532e72e authored by Thomas Guillem's avatar 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.
parent 19281ac3
...@@ -507,9 +507,17 @@ static void Flush( decoder_t *p_dec ) ...@@ -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_pts = VLC_TS_INVALID; /* To make sure we recover properly */
p_sys->i_late_frames = 0; 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 ); post_mt( p_sys );
avcodec_flush_buffers( p_context ); avcodec_flush_buffers( p_context );
wait_mt( p_sys ); wait_mt( p_sys );
/* Reset cancel state to false */
decoder_AbortPictures( p_dec, false );
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment