[vlc-commits] decoder: fix occasional deadlock on seek
Thomas Guillem
git at videolan.org
Tue Oct 10 12:52:57 CEST 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Oct 9 15:35:39 2017 +0200| [8cacc98a089ea63f7b134ffba5ff3371fbb84849] | committer: Thomas Guillem
decoder: fix occasional deadlock on seek
This commit fixes the following deadlock:
The input thread (from input_DecoderWait()) reads p_owner->b_idle, and wait on
the wait_acknowledge condition variable because p_owner->b_idle is false (and
because p_owner->b_has_data is false too). The decoder thread sets
p_owner->b_idle to true because the fifo is empty and wait on the fifo
condition variable. Both threads are waiting each others, hence the deadlock.
To fix this issue, signal the input thread from the decoder thread after
setting p_owner->b_idle to true.
Since predictable scheduling behavior is not required, p_owner->lock doesn't
have to be held while signaling p_owner->wait_acknowledge.
Fixes #16100
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8cacc98a089ea63f7b134ffba5ff3371fbb84849
---
src/input/decoder.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 54eec0f342..78c96986e4 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1571,6 +1571,7 @@ static void *DecoderThread( void *p_data )
if( p_owner->paused && p_owner->frames_countdown == 0 )
{ /* Wait for resumption from pause */
p_owner->b_idle = true;
+ vlc_cond_signal( &p_owner->wait_acknowledge );
vlc_fifo_Wait( p_owner->p_fifo );
p_owner->b_idle = false;
continue;
@@ -1585,6 +1586,7 @@ static void *DecoderThread( void *p_data )
if( likely(!p_owner->b_draining) )
{ /* Wait for a block to decode (or a request to drain) */
p_owner->b_idle = true;
+ vlc_cond_signal( &p_owner->wait_acknowledge );
vlc_fifo_Wait( p_owner->p_fifo );
p_owner->b_idle = false;
continue;
More information about the vlc-commits
mailing list