aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-06-02 08:39:17 +0200
committerMax Kellermann <max@duempel.org>2009-06-02 08:40:28 +0200
commit9ee53bc76e110b5c1222f5ec2a10721e982d6e7b (patch)
tree258a32490f1dc78b0c17bd2543572316805ffd8a /src
parentaa7f5dec87e5decd2905056938e0af0e35aa0130 (diff)
downloadmpd-9ee53bc76e110b5c1222f5ec2a10721e982d6e7b.tar.gz
mpd-9ee53bc76e110b5c1222f5ec2a10721e982d6e7b.tar.xz
mpd-9ee53bc76e110b5c1222f5ec2a10721e982d6e7b.zip
player_thread: check pipe size again before exiting
When the decoder is finished, break out of the player loop only after another player.pipe check. We did check the pipe size a few lines above, but that check was kind of racy.
Diffstat (limited to '')
-rw-r--r--src/player_thread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/player_thread.c b/src/player_thread.c
index add093083..7fc55d3d1 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -730,7 +730,11 @@ static void do_play(void)
if (!player_song_border(&player))
break;
} else if (decoder_is_idle()) {
- break;
+ /* check the size of the pipe again, because
+ the decoder thread may have added something
+ since we last checked */
+ if (music_pipe_size(player.pipe) == 0)
+ break;
} else {
/* the decoder is too busy and hasn't provided
new PCM data in time: send silence (if the