Commit a68da8a4 authored by Max Kellermann's avatar Max Kellermann

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.
parent 2a9685cb
...@@ -36,6 +36,7 @@ ver 0.16 (20??/??/??) ...@@ -36,6 +36,7 @@ ver 0.16 (20??/??/??)
- jack: don't disconnect during pause - jack: don't disconnect during pause
- jack: connect to server on MPD startup - jack: connect to server on MPD startup
- jack: added option "client_name" - jack: added option "client_name"
- jack: clear ring buffers before activating
- wildcards allowed in audio_format configuration - wildcards allowed in audio_format configuration
- alsa: don't recover on CANCEL - alsa: don't recover on CANCEL
- consistently lock audio output objects - consistently lock audio output objects
......
...@@ -335,11 +335,16 @@ mpd_jack_start(struct jack_data *jd, GError **error_r) ...@@ -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 persist until MPD exits. It's too unsafe to delete them
because we can never know when mpd_jack_process() gets because we can never know when mpd_jack_process() gets
called */ 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) if (jd->ringbuffer[i] == NULL)
jd->ringbuffer[i] = jd->ringbuffer[i] =
jack_ringbuffer_create(jd->ringbuffer_size); 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) ) { if ( jack_activate(jd->client) ) {
g_set_error(error_r, jack_output_quark(), 0, g_set_error(error_r, jack_output_quark(), 0,
"cannot activate client"); "cannot activate client");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment