From 35f5a75474dc820749531b862ba248b5c96bae62 Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Tue, 7 Apr 2020 00:13:42 +0300 Subject: [PATCH] Wait until pulseaudio server opens its socket --- audiovario.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/audiovario.c b/audiovario.c index a592fb185f..f9ec24348f 100755 --- a/audiovario.c +++ b/audiovario.c @@ -145,14 +145,16 @@ void start_pcm() { pa_threaded_mainloop_lock(mainloop); assert(pa_threaded_mainloop_start(mainloop) == 0); - assert(pa_context_connect(context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) == 0); + printf("Connecting to pulseaudio...\n"); + assert(pa_context_connect(context, NULL, PA_CONTEXT_NOAUTOSPAWN | PA_CONTEXT_NOFAIL, NULL) == 0); for(;;) { pa_context_state_t context_state = pa_context_get_state(context); assert(PA_CONTEXT_IS_GOOD(context_state)); if (context_state == PA_CONTEXT_READY) break; pa_threaded_mainloop_wait(mainloop); } + printf("Connection to pulseaudio established.\n"); pa_sample_spec sample_specifications; sample_specifications.format = FORMAT;