aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-09 22:22:27 +0100
committerMax Kellermann <max@duempel.org>2009-11-09 22:22:27 +0100
commit8420f1420fba1254b26d812ea90fef59a5cbd867 (patch)
treee858361934faf95bbc5f18961b646c45aec4d84e
parent3359f8785ef9b595b3ad943fdd2227f98ce56990 (diff)
downloadmpd-8420f1420fba1254b26d812ea90fef59a5cbd867.tar.gz
mpd-8420f1420fba1254b26d812ea90fef59a5cbd867.tar.xz
mpd-8420f1420fba1254b26d812ea90fef59a5cbd867.zip
player_thread: drain audio outputs at the end of the playlist
When there's no queued song, and the current one has finished playing, first make sure that the hardware outputs have really finished playing the last chunk: call the drain() method in all audio outputs. Without this patch, MPD stopped playback shortly before the ALSA sound card had finished playing.
-rw-r--r--NEWS2
-rw-r--r--src/player_thread.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 96fcfb1f7..d6d6f073b 100644
--- a/NEWS
+++ b/NEWS
@@ -43,6 +43,8 @@ ver 0.16 (20??/??/??)
- httpd: bind port when output is enabled
- wildcards allowed in audio_format configuration
- consistently lock audio output objects
+* player:
+ - drain audio outputs at the end of the playlist
* mixers:
- removed support for legacy mixer configuration
- reimplemented software volume as mixer+filter plugin
diff --git a/src/player_thread.c b/src/player_thread.c
index 5cb73a3ee..c527c57b6 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -874,8 +874,12 @@ static void do_play(struct decoder_control *dc)
/* 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)
+ if (music_pipe_size(player.pipe) == 0) {
+ /* wait for the hardware to finish
+ playback */
+ audio_output_all_drain();
break;
+ }
} else {
/* the decoder is too busy and hasn't provided
new PCM data in time: send silence (if the