From ddf8a0f58f3110e31ec4c44ecff838d2b231f6f3 Mon Sep 17 00:00:00 2001 From: Stephane Fontaine Date: Tue, 18 Oct 2016 22:41:04 +0400 Subject: [PATCH] Possibly Fixes #319 (#333) *tunneled* pulseaudio sinks do not have any card associated to them. --- src/pulseaudio.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pulseaudio.cc b/src/pulseaudio.cc index c654014f..0ec5cd90 100644 --- a/src/pulseaudio.cc +++ b/src/pulseaudio.cc @@ -217,12 +217,14 @@ void init_pulseaudio(struct text_object *obj) { PULSEAUDIO_WAIT(pa_context_get_sink_info_by_name(pulseaudio->context, pulseaudio->result.sink_name.c_str(), pa_sink_info_callback, &pulseaudio->result)); - if (pulseaudio->result.sink_name.empty() || pulseaudio->result.sink_card==(uint32_t)-1){ - NORM_ERR("Incorrect pulseaudio sink information."); + if (pulseaudio->result.sink_name.empty()){ + NORM_ERR("Incorrect pulseaudio sink information."); return; - } - PULSEAUDIO_WAIT(pa_context_get_card_info_by_index(pulseaudio->context, pulseaudio->result.sink_card, - pa_card_info_callback, &pulseaudio->result)); + } + + if(pulseaudio->result.sink_card!=(uint32_t)-1) + PULSEAUDIO_WAIT(pa_context_get_card_info_by_index(pulseaudio->context, pulseaudio->result.sink_card, + pa_card_info_callback, &pulseaudio->result)); // get notification when something changes in PA pa_context_set_subscribe_callback(pulseaudio->context, subscribe_cb, &pulseaudio->result);