mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
[pulseaudio] Try to spawn Pulseaudio if it doesn't by itself
Requiring the user to set up Pulseaudio in system mode is not optimal. This would, however, be required especially on headless systems. This is the sledgehammer alternative to starting Pulseaudio.
This commit is contained in:
parent
9355015b3c
commit
f202b5d2e9
@ -806,7 +806,26 @@ pulse_init(void)
|
||||
if (pa_context_connect(p->context, NULL, 0, NULL) < 0)
|
||||
{
|
||||
ret = pa_context_errno(p->context);
|
||||
goto fail;
|
||||
if (ret == PA_ERR_CONNECTIONREFUSED)
|
||||
{
|
||||
DPRINTF(E_LOG, L_LAUDIO, "Connection to Pulseaudio refused, trying to start daemon for our user\n");
|
||||
|
||||
ret = system("pulseaudio --start");
|
||||
if (ret < 0)
|
||||
{
|
||||
DPRINTF(E_LOG, L_LAUDIO, "Could not start Pulseaudio\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Try connecting again
|
||||
if (pa_context_connect(p->context, NULL, 0, NULL) < 0)
|
||||
{
|
||||
ret = pa_context_errno(p->context);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
DPRINTF(E_LOG, L_LAUDIO, "Connection to Pulseaudio established\n");
|
||||
}
|
||||
|
||||
pa_threaded_mainloop_lock(p->mainloop);
|
||||
|
Loading…
Reference in New Issue
Block a user