From 5dcdd5e3583f32c8bffb5a1892e318747070f5d8 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sat, 4 Apr 2009 22:56:38 +0300 Subject: perl -p -i -e 's/pa_rtclock_usec/pa_rtclock_now/g' `find . -name '*.[ch]'` --- src/modules/module-combine.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/modules/module-combine.c') diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index 725faa0c..69dc530b 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -282,7 +282,7 @@ static void thread_func(void *userdata) { pa_thread_mq_install(&u->thread_mq); pa_rtpoll_install(u->rtpoll); - u->thread_info.timestamp = pa_rtclock_usec(); + u->thread_info.timestamp = pa_rtclock_now(); u->thread_info.in_null_mode = FALSE; for (;;) { @@ -296,7 +296,7 @@ static void thread_func(void *userdata) { if (PA_SINK_IS_OPENED(u->sink->thread_info.state) && !u->thread_info.active_outputs) { pa_usec_t now; - now = pa_rtclock_usec(); + now = pa_rtclock_now(); if (!u->thread_info.in_null_mode || u->thread_info.timestamp <= now) process_render_null(u, now); @@ -664,16 +664,16 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse pa_atomic_store(&u->thread_info.running, PA_PTR_TO_UINT(data) == PA_SINK_RUNNING); if (PA_PTR_TO_UINT(data) == PA_SINK_SUSPENDED) - pa_smoother_pause(u->thread_info.smoother, pa_rtclock_usec()); + pa_smoother_pause(u->thread_info.smoother, pa_rtclock_now()); else - pa_smoother_resume(u->thread_info.smoother, pa_rtclock_usec(), TRUE); + pa_smoother_resume(u->thread_info.smoother, pa_rtclock_now(), TRUE); break; case PA_SINK_MESSAGE_GET_LATENCY: { pa_usec_t x, y, c, *delay = data; - x = pa_rtclock_usec(); + x = pa_rtclock_now(); y = pa_smoother_get(u->thread_info.smoother, x); c = pa_bytes_to_usec(u->thread_info.counter, &u->sink->sample_spec); @@ -730,7 +730,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse case SINK_MESSAGE_UPDATE_LATENCY: { pa_usec_t x, y, latency = (pa_usec_t) offset; - x = pa_rtclock_usec(); + x = pa_rtclock_now(); y = pa_bytes_to_usec(u->thread_info.counter, &u->sink->sample_spec); if (y > latency) -- cgit From 125c52889626b2ac408ecbcc8ea85575f5808e07 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sat, 4 Apr 2009 23:19:53 +0300 Subject: pulse: move pa_rtclock_now in pulsecommon --- src/modules/module-combine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/modules/module-combine.c') diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index 69dc530b..6ca7cd99 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -36,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +45,6 @@ #include #include #include -#include #include #include -- cgit From 0955e3d45b6e992308e2d51fcbf28a9f9376f788 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Sun, 5 Apr 2009 02:13:43 +0300 Subject: Base mainloop on pa_rtclock_now() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/modules/module-combine.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/modules/module-combine.c') diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index 6ca7cd99..757dbda4 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -225,9 +225,8 @@ static void adjust_rates(struct userdata *u) { pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_UPDATE_LATENCY, NULL, (int64_t) avg_total_latency, NULL); } -static void time_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata) { +static void time_callback(pa_mainloop_api *a, pa_time_event *e, const struct timeval *t, void *userdata) { struct userdata *u = userdata; - struct timeval n; pa_assert(u); pa_assert(a); @@ -235,9 +234,7 @@ static void time_callback(pa_mainloop_api*a, pa_time_event* e, const struct time adjust_rates(u); - pa_gettimeofday(&n); - n.tv_sec += (time_t) u->adjust_time; - u->sink->core->mainloop->time_restart(e, &n); + pa_core_rttime_restart(u->core, e, pa_rtclock_now() + u->adjust_time * PA_USEC_PER_SEC); } static void process_render_null(struct userdata *u, pa_usec_t now) { @@ -1171,12 +1168,8 @@ int pa__init(pa_module*m) { if (o->sink_input) pa_sink_input_put(o->sink_input); - if (u->adjust_time > 0) { - struct timeval tv; - pa_gettimeofday(&tv); - tv.tv_sec += (time_t) u->adjust_time; - u->time_event = m->core->mainloop->time_new(m->core->mainloop, &tv, time_callback, u); - } + if (u->adjust_time > 0) + u->time_event = pa_core_rttime_new(m->core, pa_rtclock_now() + u->adjust_time * PA_USEC_PER_SEC, time_callback, u); pa_modargs_free(ma); -- cgit