forked from enlightenment/enlightenment
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:
parent
7191c45de5
commit
235bbc087e
|
@ -841,26 +841,18 @@ _pulse_connect(void *data)
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ecore_Exe *_pulse_exe = NULL;
|
static Eina_Bool pulse_started;
|
||||||
static Ecore_Event_Handler *_pulse_exe_handler = NULL;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_shutdown(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)
|
if (!ctx)
|
||||||
return;
|
return;
|
||||||
|
if (pulse_started)
|
||||||
|
{
|
||||||
|
ecore_exe_run("pulseaudio -k", NULL);
|
||||||
|
pulse_started = EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx->connect)
|
if (ctx->connect)
|
||||||
{
|
{
|
||||||
|
@ -875,16 +867,6 @@ _shutdown(void)
|
||||||
ctx = NULL;
|
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
|
static Eina_Bool
|
||||||
_init(Emix_Event_Cb cb, const void *data)
|
_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
|
if (_pulse_connect(ctx) == EINA_TRUE) // true == failed and try again
|
||||||
{
|
{
|
||||||
_pulse_exe_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
if (!pulse_started)
|
||||||
_pulse_exe_del, NULL);
|
ecore_exe_run("pulseaudio --start", NULL);
|
||||||
_pulse_exe = ecore_exe_pipe_run
|
pulse_started = 1;
|
||||||
("pulseaudio", ECORE_EXE_NOT_LEADER | ECORE_EXE_TERM_WITH_PARENT,
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->cb = cb;
|
ctx->cb = cb;
|
||||||
|
|
Loading…
Reference in New Issue