rework how pulseaudio is started in mixer backend

calling `pulseaudio` starts a new daemon in the background. this is incorrect
behavior when a daemon already exists, so use --start. tracking the exe of
this process has no effect other than to determine when the fork()ing parent exits,
which is usually immediately

ref 35bb87529f
This commit is contained in:
Mike Blumenkrantz 2017-03-17 13:17:02 -04:00
parent 7191c45de5
commit 235bbc087e
1 changed files with 9 additions and 29 deletions

View File

@ -841,26 +841,18 @@ _pulse_connect(void *data)
return ECORE_CALLBACK_RENEW;
}
static Ecore_Exe *_pulse_exe = NULL;
static Ecore_Event_Handler *_pulse_exe_handler = NULL;
static Eina_Bool pulse_started;
static void
_shutdown(void)
{
if (_pulse_exe)
{
ecore_exe_kill(_pulse_exe);
ecore_exe_free(_pulse_exe);
_pulse_exe = NULL;
}
if (_pulse_exe_handler)
{
ecore_event_handler_del(_pulse_exe_handler);
_pulse_exe_handler = NULL;
}
if (!ctx)
return;
if (pulse_started)
{
ecore_exe_run("pulseaudio -k", NULL);
pulse_started = EINA_FALSE;
}
if (ctx->connect)
{
@ -875,16 +867,6 @@ _shutdown(void)
ctx = NULL;
}
static Eina_Bool
_pulse_exe_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Exe_Event_Del *ev = event;
if (ev->exe != _pulse_exe) return ECORE_CALLBACK_PASS_ON;
_pulse_exe = NULL;
return ECORE_CALLBACK_DONE;
}
static Eina_Bool
_init(Emix_Event_Cb cb, const void *data)
{
@ -903,11 +885,9 @@ _init(Emix_Event_Cb cb, const void *data)
if (_pulse_connect(ctx) == EINA_TRUE) // true == failed and try again
{
_pulse_exe_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
_pulse_exe_del, NULL);
_pulse_exe = ecore_exe_pipe_run
("pulseaudio", ECORE_EXE_NOT_LEADER | ECORE_EXE_TERM_WITH_PARENT,
NULL);
if (!pulse_started)
ecore_exe_run("pulseaudio --start", NULL);
pulse_started = 1;
}
ctx->cb = cb;