diff options
-rw-r--r-- | pavolctld.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pavolctld.c b/pavolctld.c index 6504f74..bb18d91 100644 --- a/pavolctld.c +++ b/pavolctld.c @@ -125,16 +125,18 @@ static void change_command_sink(pa_context *c, char *cmd) { } static void sink_info_change_default_sink_callback(pa_context *c, const pa_sink_info *i, int eol, void *userdata) { - int useridx = *(int *)userdata; + static int success = 0; // if the index passed to pa_context_get_sink_info_by_index is invalid, then eol is set immediately if (eol) { - if (useridx != default_sink_index) { - printf("e3,sink %d does not exist\n", useridx); // same as sink_info_change_command_sink_callback + if (!success) { + printf("e3,sink %d does not exist\n", *(int *)userdata); // same as sink_info_change_command_sink_callback fflush(stdout); } + success = 0; return; } + success = 1; pa_context_set_default_sink(c, i->name, NULL, NULL); } |