mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-29 11:08:35 -05:00
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>
This commit is contained in:
parent
125c528896
commit
0955e3d45b
42 changed files with 311 additions and 233 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <pulse/rtclock.h>
|
||||
#include <pulse/sample.h>
|
||||
#include <pulse/timeval.h>
|
||||
#include <pulse/utf8.h>
|
||||
|
|
@ -63,7 +64,7 @@
|
|||
#define MAX_CONNECTIONS 64
|
||||
|
||||
/* Kick a client if it doesn't authenticate within this time */
|
||||
#define AUTH_TIMEOUT 5
|
||||
#define AUTH_TIMEOUT (5*PA_USEC_PER_SEC)
|
||||
|
||||
#define DEFAULT_COOKIE_FILE ".esd_auth"
|
||||
|
||||
|
|
@ -1459,11 +1460,10 @@ static pa_usec_t source_output_get_latency_cb(pa_source_output *o) {
|
|||
|
||||
/*** entry points ***/
|
||||
|
||||
static void auth_timeout(pa_mainloop_api*m, pa_time_event *e, const struct timeval *tv, void *userdata) {
|
||||
static void auth_timeout(pa_mainloop_api *m, pa_time_event *e, const struct timeval *t, void *userdata) {
|
||||
connection *c = CONNECTION(userdata);
|
||||
|
||||
pa_assert(m);
|
||||
pa_assert(tv);
|
||||
connection_assert_ref(c);
|
||||
pa_assert(c->auth_timeout_event == e);
|
||||
|
||||
|
|
@ -1553,12 +1553,9 @@ void pa_esound_protocol_connect(pa_esound_protocol *p, pa_iochannel *io, pa_esou
|
|||
c->authorized = TRUE;
|
||||
}
|
||||
|
||||
if (!c->authorized) {
|
||||
struct timeval tv;
|
||||
pa_gettimeofday(&tv);
|
||||
tv.tv_sec += AUTH_TIMEOUT;
|
||||
c->auth_timeout_event = p->core->mainloop->time_new(p->core->mainloop, &tv, auth_timeout, c);
|
||||
} else
|
||||
if (!c->authorized)
|
||||
c->auth_timeout_event = pa_core_rttime_new(p->core, pa_rtclock_now() + AUTH_TIMEOUT, auth_timeout, c);
|
||||
else
|
||||
c->auth_timeout_event = NULL;
|
||||
|
||||
c->defer_event = p->core->mainloop->defer_new(p->core->mainloop, defer_callback, c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue