From: Martin Mares Date: Fri, 21 Nov 2014 21:30:07 +0000 (+0100) Subject: Apparently, PulseAudio sometimes removes a non-existent sink input X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=8c6ae9672d2e5326b9216c27718e40fb1c3a18b2;p=ursary.git Apparently, PulseAudio sometimes removes a non-existent sink input --- diff --git a/pulse.c b/pulse.c index 21005ba..479a5e1 100644 --- a/pulse.c +++ b/pulse.c @@ -134,6 +134,7 @@ void pulse_server_set_default_sink(const char *name) #define HASH_PREFIX(x) pulse_sink_input_##x #define HASH_KEY_ATOMIC idx #define HASH_WANT_CLEANUP +#define HASH_WANT_FIND #define HASH_WANT_LOOKUP #define HASH_WANT_REMOVE #define HASH_ZERO_FILL @@ -173,9 +174,14 @@ static void pulse_sink_input_cb(pa_context *ctx UNUSED, const pa_sink_input_info static void pulse_sink_input_gone(int idx) { DBG("Pulse: REMOVE SINK INPUT #%d", idx); - struct pulse_sink_input *s = pulse_sink_input_lookup(idx); - clist_remove(&s->n); - pulse_sink_input_remove(s); + struct pulse_sink_input *s = pulse_sink_input_find(idx); + if (s) + { + clist_remove(&s->n); + pulse_sink_input_remove(s); + } + else + DBG("Pulse: Removing sink which does not exist"); schedule_update(); }