Commit 233e8157 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

pulse: fix race where the device list was empty at start

parent 57b5d92b
...@@ -114,7 +114,10 @@ static void sink_add_cb(pa_context *ctx, const pa_sink_info *i, int eol, ...@@ -114,7 +114,10 @@ static void sink_add_cb(pa_context *ctx, const pa_sink_info *i, int eol,
aout_sys_t *sys = aout->sys; aout_sys_t *sys = aout->sys;
if (eol) if (eol)
{
pa_threaded_mainloop_signal(sys->mainloop, 0);
return; return;
}
(void) ctx; (void) ctx;
msg_Dbg(aout, "adding sink %"PRIu32": %s (%s)", i->index, i->name, msg_Dbg(aout, "adding sink %"PRIu32": %s (%s)", i->index, i->name,
...@@ -1064,8 +1067,12 @@ static int Open(vlc_object_t *obj) ...@@ -1064,8 +1067,12 @@ static int Open(vlc_object_t *obj)
pa_threaded_mainloop_lock(sys->mainloop); pa_threaded_mainloop_lock(sys->mainloop);
/* Sinks (output devices) list */ /* Sinks (output devices) list */
op = pa_context_get_sink_info_list(sys->context, sink_add_cb, aout); op = pa_context_get_sink_info_list(sys->context, sink_add_cb, aout);
if (op != NULL) if (likely(op != NULL))
{
while (pa_operation_get_state(op) == PA_OPERATION_RUNNING)
pa_threaded_mainloop_wait(sys->mainloop);
pa_operation_unref(op); pa_operation_unref(op);
}
/* Context events */ /* Context events */
const pa_subscription_mask_t mask = PA_SUBSCRIPTION_MASK_SINK const pa_subscription_mask_t mask = PA_SUBSCRIPTION_MASK_SINK
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment