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.
This commit is contained in:
Max Kellermann
2009-11-05 20:01:50 +01:00
parent 2a9685cb3a
commit a68da8a475
2 changed files with 7 additions and 1 deletions

View File

@@ -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");