aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/jack_output_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-04-04 21:38:29 +0200
committerMax Kellermann <max@duempel.org>2012-04-04 21:38:29 +0200
commite7a18625177e2831d96baf2f7fc16f23bc99975d (patch)
treee990891fe42f97ccd25f6698f72e11077d817e0a /src/output/jack_output_plugin.c
parentd8e423df1a3c4ea7db547089c8cf0647268cfd44 (diff)
downloadmpd-e7a18625177e2831d96baf2f7fc16f23bc99975d.tar.gz
mpd-e7a18625177e2831d96baf2f7fc16f23bc99975d.tar.xz
mpd-e7a18625177e2831d96baf2f7fc16f23bc99975d.zip
output/jack: workaround for libjack1 crash bug
Diffstat (limited to 'src/output/jack_output_plugin.c')
-rw-r--r--src/output/jack_output_plugin.c13
1 files changed, 13 insertions, 0 deletions
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;