diff options
Diffstat (limited to 'src/pulse/context.c')
| -rw-r--r-- | src/pulse/context.c | 37 | 
1 files changed, 34 insertions, 3 deletions
| diff --git a/src/pulse/context.c b/src/pulse/context.c index 3b7bf08d..b71659de 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -54,6 +54,8 @@  #include <pulse/utf8.h>  #include <pulse/util.h>  #include <pulse/i18n.h> +#include <pulse/mainloop.h> +#include <pulse/timeval.h>  #include <pulsecore/winsock.h>  #include <pulsecore/core-error.h> @@ -64,6 +66,7 @@  #include <pulsecore/dynarray.h>  #include <pulsecore/socket-client.h>  #include <pulsecore/pstream-util.h> +#include <pulsecore/core-rtclock.h>  #include <pulsecore/core-util.h>  #include <pulsecore/log.h>  #include <pulsecore/socket-util.h> @@ -540,7 +543,7 @@ static void setup_context(pa_context *c, pa_iochannel *io) {      pa_pstream_set_recieve_memblock_callback(c->pstream, pstream_memblock_callback, c);      pa_assert(!c->pdispatch); -    c->pdispatch = pa_pdispatch_new(c->mainloop, command_table, PA_COMMAND_MAX); +    c->pdispatch = pa_pdispatch_new(c->mainloop, c->use_rtclock, command_table, PA_COMMAND_MAX);      if (!c->conf->cookie_valid)          pa_log_info(_("No cookie loaded. Attempting to connect without.")); @@ -757,7 +760,7 @@ static void track_pulseaudio_on_dbus(pa_context *c, DBusBusType type, pa_dbus_wr      pa_assert(conn);      dbus_error_init(&error); -    if (!(*conn = pa_dbus_wrap_connection_new(c->mainloop, type, &error)) || dbus_error_is_set(&error)) { +    if (!(*conn = pa_dbus_wrap_connection_new(c->mainloop, c->use_rtclock, type, &error)) || dbus_error_is_set(&error)) {          pa_log_warn("Unable to contact DBUS: %s: %s", error.name, error.message);          goto finish;      } @@ -827,7 +830,7 @@ static int try_next_connection(pa_context *c) {          pa_xfree(c->server);          c->server = pa_xstrdup(u); -        if (!(c->client = pa_socket_client_new_string(c->mainloop, u, PA_NATIVE_DEFAULT_PORT))) +        if (!(c->client = pa_socket_client_new_string(c->mainloop, c->use_rtclock, u, PA_NATIVE_DEFAULT_PORT)))              continue;          c->is_local = !!pa_socket_client_is_local(c->client); @@ -1443,3 +1446,31 @@ finish:      if (pl)          pa_proplist_free(pl);  } + +pa_time_event* pa_context_rttime_new(pa_context *c, pa_usec_t usec, pa_time_event_cb_t cb, void *userdata) { +    struct timeval tv; + +    pa_assert(c); +    pa_assert(c->mainloop); + +    if (usec == PA_USEC_INVALID) +        return c->mainloop->time_new(c->mainloop, NULL, cb, userdata); + +    pa_timeval_rtstore(&tv, usec, c->use_rtclock); + +    return c->mainloop->time_new(c->mainloop, &tv, cb, userdata); +} + +void pa_context_rttime_restart(pa_context *c, pa_time_event *e, pa_usec_t usec) { +    struct timeval tv; + +    pa_assert(c); +    pa_assert(c->mainloop); + +    if (usec == PA_USEC_INVALID) +        c->mainloop->time_restart(e, NULL); +    else { +        pa_timeval_rtstore(&tv, usec, c->use_rtclock); +        c->mainloop->time_restart(e, &tv); +    } +} | 
