From e7a18625177e2831d96baf2f7fc16f23bc99975d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Apr 2012 21:38:29 +0200 Subject: output/jack: workaround for libjack1 crash bug --- src/output/jack_output_plugin.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/output/jack_output_plugin.c') diff --git a/src/output/jack_output_plugin.c b/src/output/jack_output_plugin.c index 2767d4eb8..bc13c2f85 100644 --- a/src/output/jack_output_plugin.c +++ b/src/output/jack_output_plugin.c @@ -143,6 +143,13 @@ mpd_jack_process(jack_nframes_t nframes, void *arg) for (unsigned i = 0; i < jd->audio_format.channels; ++i) { out = jack_port_get_buffer(jd->ports[i], nframes); + if (out == NULL) + /* workaround for libjack1 bug: if the server + connection fails, the process callback is + invoked anyway, but unable to get a + buffer */ + continue; + jack_ringbuffer_read(jd->ringbuffer[i], (char *)out, available * jack_sample_size); @@ -156,6 +163,12 @@ mpd_jack_process(jack_nframes_t nframes, void *arg) for (unsigned i = jd->audio_format.channels; i < jd->num_source_ports; ++i) { out = jack_port_get_buffer(jd->ports[i], nframes); + if (out == NULL) + /* workaround for libjack1 bug: if the server + connection fails, the process callback is + invoked anyway, but unable to get a + buffer */ + continue; for (jack_nframes_t f = 0; f < nframes; ++f) out[f] = 0.0; -- cgit v1.2.3 From a9edf85a692e6afbe6c5efc9f2784e2c5d191eab Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Apr 2012 21:40:56 +0200 Subject: output/jack: check for connection failure before starting playback --- src/output/jack_output_plugin.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/output/jack_output_plugin.c') diff --git a/src/output/jack_output_plugin.c b/src/output/jack_output_plugin.c index bc13c2f85..c67fcd38a 100644 --- a/src/output/jack_output_plugin.c +++ b/src/output/jack_output_plugin.c @@ -576,6 +576,9 @@ mpd_jack_open(void *data, struct audio_format *audio_format, GError **error_r) jd->pause = false; + if (jd->client != NULL && jd->shutdown) + mpd_jack_disconnect(jd); + if (jd->client == NULL && !mpd_jack_connect(jd, error_r)) return false; -- cgit v1.2.3