2013/11/30 Mike Blumenkrantz <zm...@samsung.com> > discomfitor pushed a commit to branch master. > > > http://git.enlightenment.org/core/enlightenment.git/commit/?id=8c1f521738ad3d2276b0b2c27bc2d6f3e8bd81d3 > > commit 8c1f521738ad3d2276b0b2c27bc2d6f3e8bd81d3 > Author: Mike Blumenkrantz <zm...@samsung.com> > Date: Sat Nov 30 11:11:30 2013 -0500 > > fix pulse mixer startup > > dbus starting this is the wrong way to go I guess, e_exec is much > simpler > > fix T410 just in time for release! >
This badly HANG my pc !! Now when E start it try to spawn the pulse daemon hundred of times A short look at the code seems to explain the problem: 1. on e_mixer_pulse_init(), if you can't connect to pulse, you run the daemon 2. in the _pulse_started() cb you call e_mixer_pulse_init() another time If for some reason the daemon wont start successfully (that seems to be my case) the infinite loop between the 2 functions is simple and the daemon is spawned forever really fast... I think this has to be reverted PS: the mixer was working well before this commit. > --- > src/modules/mixer/sys_pulse.c | 114 > ++++++------------------------------------ > 1 file changed, 14 insertions(+), 100 deletions(-) > > diff --git a/src/modules/mixer/sys_pulse.c b/src/modules/mixer/sys_pulse.c > index 2376335..0a0e51b 100644 > --- a/src/modules/mixer/sys_pulse.c > +++ b/src/modules/mixer/sys_pulse.c > @@ -2,19 +2,14 @@ > #include "e_mod_mixer.h" > #include "Pulse.h" > > -#define PULSE_BUS "org.PulseAudio.Core1" > -#define PULSE_PATH "/org/pulseaudio/core1" > -#define PULSE_INTERFACE "org.PulseAudio.Core1" > +static E_Exec_Instance *pulse_inst = NULL; > > static Pulse *conn = NULL; > static Pulse_Server_Info *info = NULL; > static Pulse_Sink *default_sink = NULL; > -static Ecore_Event_Handler *ph = NULL; > -static Ecore_Event_Handler *pch = NULL; > -static Ecore_Event_Handler *pdh = NULL; > +static Eina_List *handlers = NULL; > static Eina_List *sinks = NULL; > static Eina_List *sources = NULL; > -static Ecore_Poller *pulse_poller = NULL; > static Eina_Hash *queue_states = NULL; > static const char *_name = NULL; > > @@ -26,59 +21,13 @@ static unsigned int disc_count = 0; > static unsigned int update_count = 0; > static Ecore_Timer *update_timer = NULL; > > -static Eina_Bool > -_pulse_poller_cb(void *d __UNUSED__) > -{ > - char buf[4096]; > - > - snprintf(buf, sizeof(buf), "%s/.pulse-cookie", getenv("HOME")); > - if (ecore_file_exists(buf)) > - return !e_mixer_pulse_init(); > - return EINA_TRUE; > -} > - > -static void > -_dbus_poll(void *data EINA_UNUSED, const Eldbus_Message *msg) > -{ > - const char *name, *from, *to; > - if (eldbus_message_arguments_get(msg, "sss", &name, &from, &to)) > - { > - if (!strcmp(name, PULSE_BUS)) > - e_mixer_pulse_init(); > - } > - > - if (dbus_handler) > - { > - eldbus_signal_handler_del(dbus_handler); > - dbus_handler = NULL; > - } > - if (dbus) > - { > - eldbus_connection_unref(dbus); > - dbus = NULL; > - eldbus_shutdown(); > - } > -} > > -static void > -_dbus_test(void *data EINA_UNUSED, const Eldbus_Message *msg, > Eldbus_Pending *pending EINA_UNUSED) > +static Eina_Bool > +_pulse_started(void *data EINA_UNUSED, int type EINA_UNUSED, > E_Exec_Instance *inst) > { > - if (eldbus_message_error_get(msg, NULL, NULL)) > - { > - if (dbus_handler) > - { > - eldbus_signal_handler_del(dbus_handler); > - dbus_handler = NULL; > - } > - if (dbus) > - { > - eldbus_connection_unref(dbus); > - dbus = NULL; > - eldbus_shutdown(); > - } > - e_mod_mixer_pulse_ready(EINA_FALSE); > - return; > - } > + if (inst != pulse_inst) return ECORE_CALLBACK_RENEW; > + e_mixer_pulse_init(); > + return ECORE_CALLBACK_DONE; > } > > static void > @@ -339,52 +288,22 @@ e_mixer_pulse_init(void) > { > pulse_init(); > conn = pulse_new(); > - if (dbus) goto error; > if ((!conn) || (!pulse_connect(conn))) > { > - Eldbus_Message *msg; > - double interval; > + pulse_inst = e_exec(NULL, NULL, "pulseaudio -D", NULL, NULL); > + if (!pulse_inst) return EINA_FALSE; > > - eldbus_init(); > - dbus = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); > - > - if (!dbus) > - { > - eldbus_shutdown(); > - return EINA_FALSE; > - } > - > - if (!pulse_poller) > - { > - interval = ecore_poller_poll_interval_get(ECORE_POLLER_CORE); > - /* polling every 5 seconds or so I guess ? */ > - pulse_poller = ecore_poller_add(ECORE_POLLER_CORE, 5.0 / > interval, > - _pulse_poller_cb, NULL); > - } > - if (!dbus_handler) > - dbus_handler = eldbus_signal_handler_add(dbus, ELDBUS_FDO_BUS, > - ELDBUS_FDO_PATH, > - ELDBUS_FDO_INTERFACE, > - "NameOwnerChanged", > _dbus_poll, NULL); > - > - msg = eldbus_message_method_call_new(PULSE_BUS, PULSE_PATH, > PULSE_INTERFACE, "suuuuuup"); > - eldbus_connection_send(dbus, msg, _dbus_test, NULL, -1); /* test > for not running pulse */ > + E_LIST_HANDLER_APPEND(handlers, E_EVENT_EXEC_NEW, > (Ecore_Event_Handler_Cb)_pulse_started, NULL); > pulse_free(conn); > conn = NULL; > pulse_shutdown(); > return EINA_TRUE; > } > - pulse_poller = NULL; > - ph = ecore_event_handler_add(PULSE_EVENT_CONNECTED, > (Ecore_Event_Handler_Cb)_pulse_connected, conn); > - pch = ecore_event_handler_add(PULSE_EVENT_CHANGE, > (Ecore_Event_Handler_Cb)_pulse_update, conn); > - pdh = ecore_event_handler_add(PULSE_EVENT_DISCONNECTED, > (Ecore_Event_Handler_Cb)_pulse_disconnected, conn); > + E_LIST_HANDLER_APPEND(handlers, PULSE_EVENT_CONNECTED, > (Ecore_Event_Handler_Cb)_pulse_connected, conn); > + E_LIST_HANDLER_APPEND(handlers, PULSE_EVENT_CHANGE, > (Ecore_Event_Handler_Cb)_pulse_update, conn); > + E_LIST_HANDLER_APPEND(handlers, PULSE_EVENT_DISCONNECTED, > (Ecore_Event_Handler_Cb)_pulse_disconnected, conn); > if (!_name) _name = eina_stringshare_add("Output"); > return EINA_TRUE; > -error: > - pulse_free(conn); > - conn = NULL; > - pulse_shutdown(); > - return EINA_FALSE; > } > > void > @@ -404,12 +323,7 @@ e_mixer_pulse_shutdown(void) > > pulse_free(conn); > conn = NULL; > - if (ph) ecore_event_handler_del(ph); > - ph = NULL; > - if (pch) ecore_event_handler_del(pch); > - pch = NULL; > - if (pdh) ecore_event_handler_del(pdh); > - pdh = NULL; > + E_FREE_LIST(handlers, ecore_event_handler_del); > if (queue_states) eina_hash_free(queue_states); > queue_states = NULL; > if (dbus_handler) > > -- > > > ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel