aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-05 20:01:50 +0100
committerMax Kellermann <max@duempel.org>2009-11-05 20:01:50 +0100
commita68da8a475292ba77cf144789b50c691ec83c719 (patch)
tree234a90730c80f4899261625a4af1df1d47fdc892
parent2a9685cb3ad50702bad8789ab4c7d7837a4579fe (diff)
downloadmpd-a68da8a475292ba77cf144789b50c691ec83c719.tar.gz
mpd-a68da8a475292ba77cf144789b50c691ec83c719.tar.xz
mpd-a68da8a475292ba77cf144789b50c691ec83c719.zip
output/jack: clear ring buffers before activating
After playback has stopped, the ring buffers may still contain samples. These will be played when playback is started the next time. We should clear the buffers each time.
-rw-r--r--NEWS1
-rw-r--r--src/output/jack_output_plugin.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 88f7a8fa5..ddbdf63c4 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,7 @@ ver 0.16 (20??/??/??)
- jack: don't disconnect during pause
- jack: connect to server on MPD startup
- jack: added option "client_name"
+ - jack: clear ring buffers before activating
- wildcards allowed in audio_format configuration
- alsa: don't recover on CANCEL
- consistently lock audio output objects
diff --git a/src/output/jack_output_plugin.c b/src/output/jack_output_plugin.c
index 51c148282..8ada73efc 100644
--- a/src/output/jack_output_plugin.c
+++ b/src/output/jack_output_plugin.c
@@ -335,11 +335,16 @@ mpd_jack_start(struct jack_data *jd, GError **error_r)
persist until MPD exits. It's too unsafe to delete them
because we can never know when mpd_jack_process() gets
called */
- for (unsigned i = 0; i < G_N_ELEMENTS(jd->ringbuffer); ++i)
+ for (unsigned i = 0; i < G_N_ELEMENTS(jd->ringbuffer); ++i) {
if (jd->ringbuffer[i] == NULL)
jd->ringbuffer[i] =
jack_ringbuffer_create(jd->ringbuffer_size);
+ /* clear the ring buffer to be sure that data from
+ previous playbacks are gone */
+ jack_ringbuffer_reset(jd->ringbuffer[i]);
+ }
+
if ( jack_activate(jd->client) ) {
g_set_error(error_r, jack_output_quark(), 0,
"cannot activate client");