aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/jack_output_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-04-05 00:45:39 +0200
committerMax Kellermann <max@duempel.org>2012-04-05 00:45:39 +0200
commitc22cbbf8280bb35c8fee5ae3931d3bc08b70099f (patch)
tree4654b9834f51c32746e2f72ce64191149647d87e /src/output/jack_output_plugin.c
parentf930f37d35995f0fc07f70aefc41babc0db1757e (diff)
parent5acee73fc85e44179120a5818247fc0760038cff (diff)
downloadmpd-c22cbbf8280bb35c8fee5ae3931d3bc08b70099f.tar.gz
mpd-c22cbbf8280bb35c8fee5ae3931d3bc08b70099f.tar.xz
mpd-c22cbbf8280bb35c8fee5ae3931d3bc08b70099f.zip
Merge branch 'v0.16.x'
Conflicts: src/output/osx_plugin.c src/text_input_stream.c
Diffstat (limited to 'src/output/jack_output_plugin.c')
-rw-r--r--src/output/jack_output_plugin.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/output/jack_output_plugin.c b/src/output/jack_output_plugin.c
index cd769088b..a24cb8557 100644
--- a/src/output/jack_output_plugin.c
+++ b/src/output/jack_output_plugin.c
@@ -146,6 +146,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);
@@ -159,6 +166,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;
@@ -572,6 +585,9 @@ mpd_jack_open(struct audio_output *ao, struct audio_format *audio_format,
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;