diff options
author | Max Kellermann <max@duempel.org> | 2010-03-10 19:48:27 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-03-10 19:48:49 +0100 |
commit | 762565e9d11b19534cff2d74715af0645f3885d8 (patch) | |
tree | 06678636cc6aa666dca9f28074d94f111a075917 /src | |
parent | 41a4662c8ccce7a22ff9d05ecf40d3ce7de29305 (diff) | |
download | mpd-762565e9d11b19534cff2d74715af0645f3885d8.tar.gz mpd-762565e9d11b19534cff2d74715af0645f3885d8.tar.xz mpd-762565e9d11b19534cff2d74715af0645f3885d8.zip |
output/jack: drain the ring buffers during pause
If we're not doing this, and a new song is played after pause ends,
then you will hear the rest of the previous song.
Diffstat (limited to 'src')
-rw-r--r-- | src/output/jack_output_plugin.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/output/jack_output_plugin.c b/src/output/jack_output_plugin.c index 5a89d7919..110ee5f26 100644 --- a/src/output/jack_output_plugin.c +++ b/src/output/jack_output_plugin.c @@ -118,6 +118,13 @@ mpd_jack_process(jack_nframes_t nframes, void *arg) return 0; if (jd->pause) { + /* empty the ring buffers */ + + const jack_nframes_t available = mpd_jack_available(jd); + for (unsigned i = 0; i < jd->audio_format.channels; ++i) + jack_ringbuffer_read_advance(jd->ringbuffer[i], + available * sample_size); + /* generate silence while MPD is paused */ for (unsigned i = 0; i < jd->audio_format.channels; ++i) { |