From f753ef2a23c0c42e5ad35a36327a9fda2e4f2d98 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 22 Jun 2009 23:49:40 +0200 Subject: rtclock: enable rtclock for our own mainloop implementations --- src/pulse/context.c | 1 + src/pulse/internal.h | 2 ++ src/pulse/mainloop.c | 15 +++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/pulse/context.c b/src/pulse/context.c index b71659de..505e758a 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -160,6 +160,7 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char * c->playback_streams = pa_dynarray_new(); c->record_streams = pa_dynarray_new(); c->client_index = PA_INVALID_INDEX; + c->use_rtclock = pa_mainloop_is_our_api(mainloop); PA_LLIST_HEAD_INIT(pa_stream, c->streams); PA_LLIST_HEAD_INIT(pa_operation, c->operations); diff --git a/src/pulse/internal.h b/src/pulse/internal.h index fa5efd7d..ec2da85b 100644 --- a/src/pulse/internal.h +++ b/src/pulse/internal.h @@ -280,4 +280,6 @@ pa_tagstruct *pa_tagstruct_command(pa_context *c, uint32_t command, uint32_t *ta void pa_ext_stream_restore_command(pa_context *c, uint32_t tag, pa_tagstruct *t); +pa_bool_t pa_mainloop_is_our_api(pa_mainloop_api*m); + #endif diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c index 5d0e0ffc..c418d108 100644 --- a/src/pulse/mainloop.c +++ b/src/pulse/mainloop.c @@ -56,6 +56,7 @@ #include #include "mainloop.h" +#include "internal.h" struct pa_io_event { pa_mainloop *mainloop; @@ -456,10 +457,10 @@ static void mainloop_quit(pa_mainloop_api*a, int retval) { static const pa_mainloop_api vtable = { .userdata = NULL, - .io_new= mainloop_io_new, - .io_enable= mainloop_io_enable, - .io_free= mainloop_io_free, - .io_set_destroy= mainloop_io_set_destroy, + .io_new = mainloop_io_new, + .io_enable = mainloop_io_enable, + .io_free = mainloop_io_free, + .io_set_destroy = mainloop_io_set_destroy, .time_new = mainloop_time_new, .time_restart = mainloop_time_restart, @@ -994,3 +995,9 @@ void pa_mainloop_set_poll_func(pa_mainloop *m, pa_poll_func poll_func, void *use m->poll_func = poll_func; m->poll_func_userdata = userdata; } + +pa_bool_t pa_mainloop_is_our_api(pa_mainloop_api*m) { + pa_assert(m); + + return m->io_new == mainloop_io_new; +} -- cgit