diff options
| author | Marc-André Lureau <marc-andre.lureau@nokia.com> | 2009-04-05 02:13:43 +0300 | 
|---|---|---|
| committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2009-06-20 17:29:31 +0300 | 
| commit | 0955e3d45b6e992308e2d51fcbf28a9f9376f788 (patch) | |
| tree | 4fc673713b46d0fdd33c5529d1a06354db9d33ba /src/modules/rtp/module-rtp-recv.c | |
| parent | 125c52889626b2ac408ecbcc8ea85575f5808e07 (diff) | |
Base mainloop on pa_rtclock_now()
Move the mainloop to monotonic based time events.
Introduces 4 helper functions:
pa_{context,core}_rttime_{new,restart}(), that fill correctly a
timeval with the rtclock flag set if the mainloop supports it.
Both mainloop-test and mainloop-test-glib works with rt and timeval
based time events. PulseAudio and clients should be fully functional.
This patch has received several iterations, and this one as been
largely untested.
Signed-off-by: Marc-André Lureau <marca-andre.lureau@nokia.com>
Diffstat (limited to 'src/modules/rtp/module-rtp-recv.c')
| -rw-r--r-- | src/modules/rtp/module-rtp-recv.c | 15 | 
1 files changed, 5 insertions, 10 deletions
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c index 84cf07de..5caf8272 100644 --- a/src/modules/rtp/module-rtp-recv.c +++ b/src/modules/rtp/module-rtp-recv.c @@ -113,6 +113,7 @@ struct session {  struct userdata {      pa_module *module; +    pa_core *core;      pa_sap_context sap_context;      pa_io_event* sap_event; @@ -622,15 +623,13 @@ static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event      }  } -static void check_death_event_cb(pa_mainloop_api *m, pa_time_event *t, const struct timeval *ptv, void *userdata) { +static void check_death_event_cb(pa_mainloop_api *m, pa_time_event *t, const struct timeval *tv, void *userdata) {      struct session *s, *n;      struct userdata *u = userdata;      struct timeval now; -    struct timeval tv;      pa_assert(m);      pa_assert(t); -    pa_assert(ptv);      pa_assert(u);      pa_rtclock_get(&now); @@ -648,9 +647,7 @@ static void check_death_event_cb(pa_mainloop_api *m, pa_time_event *t, const str      }      /* Restart timer */ -    pa_gettimeofday(&tv); -    pa_timeval_add(&tv, DEATH_TIMEOUT*PA_USEC_PER_SEC); -    m->time_restart(t, &tv); +    pa_core_rttime_restart(u->module->core, t, pa_rtclock_now() + DEATH_TIMEOUT * PA_USEC_PER_SEC);  }  int pa__init(pa_module*m) { @@ -664,7 +661,6 @@ int pa__init(pa_module*m) {      socklen_t salen;      const char *sap_address;      int fd = -1; -    struct timeval tv;      pa_assert(m); @@ -697,6 +693,7 @@ int pa__init(pa_module*m) {      m->userdata = u = pa_xnew(struct userdata, 1);      u->module = m; +    u->core = m->core;      u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));      u->sap_event = m->core->mainloop->io_new(m->core->mainloop, fd, PA_IO_EVENT_INPUT, sap_event_cb, u); @@ -706,9 +703,7 @@ int pa__init(pa_module*m) {      u->n_sessions = 0;      u->by_origin = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); -    pa_gettimeofday(&tv); -    pa_timeval_add(&tv, DEATH_TIMEOUT * PA_USEC_PER_SEC); -    u->check_death_event = m->core->mainloop->time_new(m->core->mainloop, &tv, check_death_event_cb, u); +    u->check_death_event = pa_core_rttime_new(m->core, pa_rtclock_now() + DEATH_TIMEOUT * PA_USEC_PER_SEC, check_death_event_cb, u);      pa_modargs_free(ma);  | 
