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.
This commit is contained in:
Max Kellermann 2010-03-10 19:48:27 +01:00
parent 41a4662c8c
commit 762565e9d1

View File

@ -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) {