From efb528f97986a21571c44cd0f9cde4fdfc1d185c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 12 Jan 2018 14:30:40 +0100 Subject: [PATCH] player/Thread: wake up the decoder when the pipe has run empty This is another instance of the kludge we already have a few lines above that. It works around a deadlock/race condition revealed by commit 98a7c62d7a4f716d90af6d78e18d1a3b10bc54b3 --- src/player/Thread.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index e68c2e412..7ccb6e4c9 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -1027,7 +1027,9 @@ Player::Run() noexcept /* wake up the decoder (just in case it's waiting for space in the MusicBuffer) and wait for it */ + // TODO: eliminate this kludge dc.Signal(); + dc.WaitForDecoder(); } else if (IsDecoderAtNextSong()) { /* at the beginning of a new song */ @@ -1049,6 +1051,12 @@ Player::Run() noexcept new PCM data in time: wait for the decoder */ + /* wake up the decoder (just in case it's + waiting for space in the MusicBuffer) and + wait for it */ + // TODO: eliminate this kludge + dc.Signal(); + dc.WaitForDecoder(); } }