perl -p -i -e 's/pa_rtclock_usec/pa_rtclock_now/g' find . -name '*.[ch]'

This commit is contained in:
Marc-André Lureau 2009-04-04 22:56:38 +03:00 committed by Marc-André Lureau
parent 6ad3855639
commit 5dcdd5e358
18 changed files with 66 additions and 66 deletions

View file

@ -125,7 +125,7 @@ static void signal_handler(int sig) {
char t[256]; char t[256];
#endif #endif
now = pa_rtclock_usec(); now = pa_rtclock_now();
elapsed = now - last_time; elapsed = now - last_time;
#ifdef PRINT_CPU_LOAD #ifdef PRINT_CPU_LOAD
@ -184,7 +184,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) {
pa_assert(the_pipe[1] == -1); pa_assert(the_pipe[1] == -1);
pa_assert(!installed); pa_assert(!installed);
last_time = pa_rtclock_usec(); last_time = pa_rtclock_now();
/* Prepare the main loop pipe */ /* Prepare the main loop pipe */
if (pipe(the_pipe) < 0) { if (pipe(the_pipe) < 0) {

View file

@ -707,7 +707,7 @@ static void update_smoother(struct userdata *u) {
/* Hmm, if the timestamp is 0, then it wasn't set and we take the current time */ /* Hmm, if the timestamp is 0, then it wasn't set and we take the current time */
if (now1 <= 0) if (now1 <= 0)
now1 = pa_rtclock_usec(); now1 = pa_rtclock_now();
now2 = pa_bytes_to_usec((uint64_t) position, &u->sink->sample_spec); now2 = pa_bytes_to_usec((uint64_t) position, &u->sink->sample_spec);
@ -721,7 +721,7 @@ static pa_usec_t sink_get_latency(struct userdata *u) {
pa_assert(u); pa_assert(u);
now1 = pa_rtclock_usec(); now1 = pa_rtclock_now();
now2 = pa_smoother_get(u->smoother, now1); now2 = pa_smoother_get(u->smoother, now1);
delay = (int64_t) pa_bytes_to_usec(u->write_count, &u->sink->sample_spec) - (int64_t) now2; delay = (int64_t) pa_bytes_to_usec(u->write_count, &u->sink->sample_spec) - (int64_t) now2;
@ -752,7 +752,7 @@ static int suspend(struct userdata *u) {
pa_assert(u); pa_assert(u);
pa_assert(u->pcm_handle); pa_assert(u->pcm_handle);
pa_smoother_pause(u->smoother, pa_rtclock_usec()); pa_smoother_pause(u->smoother, pa_rtclock_now());
/* Let's suspend -- we don't call snd_pcm_drain() here since that might /* Let's suspend -- we don't call snd_pcm_drain() here since that might
* take awfully long with our long buffer sizes today. */ * take awfully long with our long buffer sizes today. */
@ -1246,7 +1246,7 @@ static void thread_func(void *userdata) {
pa_log_info("Starting playback."); pa_log_info("Starting playback.");
snd_pcm_start(u->pcm_handle); snd_pcm_start(u->pcm_handle);
pa_smoother_resume(u->smoother, pa_rtclock_usec(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE);
} }
update_smoother(u); update_smoother(u);
@ -1275,7 +1275,7 @@ static void thread_func(void *userdata) {
/* Convert from the sound card time domain to the /* Convert from the sound card time domain to the
* system time domain */ * system time domain */
cusec = pa_smoother_translate(u->smoother, pa_rtclock_usec(), sleep_usec); cusec = pa_smoother_translate(u->smoother, pa_rtclock_now(), sleep_usec);
/* pa_log_debug("Waking up in %0.2fms (system clock).", (double) cusec / PA_USEC_PER_MSEC); */ /* pa_log_debug("Waking up in %0.2fms (system clock).", (double) cusec / PA_USEC_PER_MSEC); */
@ -1581,7 +1581,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
TRUE, TRUE,
TRUE, TRUE,
5, 5,
pa_rtclock_usec(), pa_rtclock_now(),
TRUE); TRUE);
dev_id = pa_modargs_get_value( dev_id = pa_modargs_get_value(

View file

@ -669,7 +669,7 @@ static void update_smoother(struct userdata *u) {
/* Hmm, if the timestamp is 0, then it wasn't set and we take the current time */ /* Hmm, if the timestamp is 0, then it wasn't set and we take the current time */
if (now1 <= 0) if (now1 <= 0)
now1 = pa_rtclock_usec(); now1 = pa_rtclock_now();
now2 = pa_bytes_to_usec(position, &u->source->sample_spec); now2 = pa_bytes_to_usec(position, &u->source->sample_spec);
@ -682,7 +682,7 @@ static pa_usec_t source_get_latency(struct userdata *u) {
pa_assert(u); pa_assert(u);
now1 = pa_rtclock_usec(); now1 = pa_rtclock_now();
now2 = pa_smoother_get(u->smoother, now1); now2 = pa_smoother_get(u->smoother, now1);
delay = (int64_t) now2 - (int64_t) pa_bytes_to_usec(u->read_count, &u->source->sample_spec); delay = (int64_t) now2 - (int64_t) pa_bytes_to_usec(u->read_count, &u->source->sample_spec);
@ -707,7 +707,7 @@ static int suspend(struct userdata *u) {
pa_assert(u); pa_assert(u);
pa_assert(u->pcm_handle); pa_assert(u->pcm_handle);
pa_smoother_pause(u->smoother, pa_rtclock_usec()); pa_smoother_pause(u->smoother, pa_rtclock_now());
/* Let's suspend */ /* Let's suspend */
snd_pcm_close(u->pcm_handle); snd_pcm_close(u->pcm_handle);
@ -833,7 +833,7 @@ static int unsuspend(struct userdata *u) {
/* FIXME: We need to reload the volume somehow */ /* FIXME: We need to reload the volume somehow */
snd_pcm_start(u->pcm_handle); snd_pcm_start(u->pcm_handle);
pa_smoother_resume(u->smoother, pa_rtclock_usec(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE);
pa_log_info("Resumed successfully..."); pa_log_info("Resumed successfully...");
@ -1131,7 +1131,7 @@ static void thread_func(void *userdata) {
/* Convert from the sound card time domain to the /* Convert from the sound card time domain to the
* system time domain */ * system time domain */
cusec = pa_smoother_translate(u->smoother, pa_rtclock_usec(), sleep_usec); cusec = pa_smoother_translate(u->smoother, pa_rtclock_now(), sleep_usec);
/* pa_log_debug("Waking up in %0.2fms (system clock).", (double) cusec / PA_USEC_PER_MSEC); */ /* pa_log_debug("Waking up in %0.2fms (system clock).", (double) cusec / PA_USEC_PER_MSEC); */
@ -1431,7 +1431,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
TRUE, TRUE,
TRUE, TRUE,
5, 5,
pa_rtclock_usec(), pa_rtclock_now(),
FALSE); FALSE);
dev_id = pa_modargs_get_value( dev_id = pa_modargs_get_value(

View file

@ -773,7 +773,7 @@ static int start_stream_fd(struct userdata *u) {
TRUE, TRUE,
TRUE, TRUE,
10, 10,
pa_rtclock_usec(), pa_rtclock_now(),
TRUE); TRUE);
return 0; return 0;
@ -867,14 +867,14 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
if (u->read_smoother) { if (u->read_smoother) {
pa_usec_t wi, ri; pa_usec_t wi, ri;
ri = pa_smoother_get(u->read_smoother, pa_rtclock_usec()); ri = pa_smoother_get(u->read_smoother, pa_rtclock_now());
wi = pa_bytes_to_usec(u->write_index + u->block_size, &u->sample_spec); wi = pa_bytes_to_usec(u->write_index + u->block_size, &u->sample_spec);
*((pa_usec_t*) data) = wi > ri ? wi - ri : 0; *((pa_usec_t*) data) = wi > ri ? wi - ri : 0;
} else { } else {
pa_usec_t ri, wi; pa_usec_t ri, wi;
ri = pa_rtclock_usec() - u->started_at; ri = pa_rtclock_now() - u->started_at;
wi = pa_bytes_to_usec(u->write_index, &u->sample_spec); wi = pa_bytes_to_usec(u->write_index, &u->sample_spec);
*((pa_usec_t*) data) = wi > ri ? wi - ri : 0; *((pa_usec_t*) data) = wi > ri ? wi - ri : 0;
@ -912,7 +912,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
stop_stream_fd(u); stop_stream_fd(u);
if (u->read_smoother) if (u->read_smoother)
pa_smoother_pause(u->read_smoother, pa_rtclock_usec()); pa_smoother_pause(u->read_smoother, pa_rtclock_now());
break; break;
case PA_SOURCE_IDLE: case PA_SOURCE_IDLE:
@ -939,7 +939,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
case PA_SOURCE_MESSAGE_GET_LATENCY: { case PA_SOURCE_MESSAGE_GET_LATENCY: {
pa_usec_t wi, ri; pa_usec_t wi, ri;
wi = pa_smoother_get(u->read_smoother, pa_rtclock_usec()); wi = pa_smoother_get(u->read_smoother, pa_rtclock_now());
ri = pa_bytes_to_usec(u->read_index, &u->sample_spec); ri = pa_bytes_to_usec(u->read_index, &u->sample_spec);
*((pa_usec_t*) data) = (wi > ri ? wi - ri : 0) + u->source->fixed_latency; *((pa_usec_t*) data) = (wi > ri ? wi - ri : 0) + u->source->fixed_latency;
@ -1086,7 +1086,7 @@ static int hsp_process_push(struct userdata *u) {
if (!found_tstamp) { if (!found_tstamp) {
pa_log_warn("Couldn't find SO_TIMESTAMP data in auxiliary recvmsg() data!"); pa_log_warn("Couldn't find SO_TIMESTAMP data in auxiliary recvmsg() data!");
tstamp = pa_rtclock_usec(); tstamp = pa_rtclock_now();
} }
pa_smoother_put(u->read_smoother, tstamp, pa_bytes_to_usec(u->read_index, &u->sample_spec)); pa_smoother_put(u->read_smoother, tstamp, pa_bytes_to_usec(u->read_index, &u->sample_spec));
@ -1309,7 +1309,7 @@ static void thread_func(void *userdata) {
/* Hmm, there is no input stream we could synchronize /* Hmm, there is no input stream we could synchronize
* to. So let's do things by time */ * to. So let's do things by time */
time_passed = pa_rtclock_usec() - u->started_at; time_passed = pa_rtclock_now() - u->started_at;
audio_sent = pa_bytes_to_usec(u->write_index, &u->sample_spec); audio_sent = pa_bytes_to_usec(u->write_index, &u->sample_spec);
if (audio_sent <= time_passed) { if (audio_sent <= time_passed) {
@ -1341,7 +1341,7 @@ static void thread_func(void *userdata) {
int n_written; int n_written;
if (u->write_index <= 0) if (u->write_index <= 0)
u->started_at = pa_rtclock_usec(); u->started_at = pa_rtclock_now();
if (u->profile == PROFILE_A2DP) { if (u->profile == PROFILE_A2DP) {
if ((n_written = a2dp_process_render(u)) < 0) if ((n_written = a2dp_process_render(u)) < 0)
@ -1361,7 +1361,7 @@ static void thread_func(void *userdata) {
/* Hmm, there is no input stream we could synchronize /* Hmm, there is no input stream we could synchronize
* to. So let's estimate when we need to wake up the latest */ * to. So let's estimate when we need to wake up the latest */
time_passed = pa_rtclock_usec() - u->started_at; time_passed = pa_rtclock_now() - u->started_at;
next_write_at = pa_bytes_to_usec(u->write_index, &u->sample_spec); next_write_at = pa_bytes_to_usec(u->write_index, &u->sample_spec);
sleep_for = time_passed < next_write_at ? next_write_at - time_passed : 0; sleep_for = time_passed < next_write_at ? next_write_at - time_passed : 0;

View file

@ -282,7 +282,7 @@ static void thread_func(void *userdata) {
pa_thread_mq_install(&u->thread_mq); pa_thread_mq_install(&u->thread_mq);
pa_rtpoll_install(u->rtpoll); 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; u->thread_info.in_null_mode = FALSE;
for (;;) { 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) { if (PA_SINK_IS_OPENED(u->sink->thread_info.state) && !u->thread_info.active_outputs) {
pa_usec_t now; pa_usec_t now;
now = pa_rtclock_usec(); now = pa_rtclock_now();
if (!u->thread_info.in_null_mode || u->thread_info.timestamp <= now) if (!u->thread_info.in_null_mode || u->thread_info.timestamp <= now)
process_render_null(u, 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); pa_atomic_store(&u->thread_info.running, PA_PTR_TO_UINT(data) == PA_SINK_RUNNING);
if (PA_PTR_TO_UINT(data) == PA_SINK_SUSPENDED) 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 else
pa_smoother_resume(u->thread_info.smoother, pa_rtclock_usec(), TRUE); pa_smoother_resume(u->thread_info.smoother, pa_rtclock_now(), TRUE);
break; break;
case PA_SINK_MESSAGE_GET_LATENCY: { case PA_SINK_MESSAGE_GET_LATENCY: {
pa_usec_t x, y, c, *delay = data; 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); y = pa_smoother_get(u->thread_info.smoother, x);
c = pa_bytes_to_usec(u->thread_info.counter, &u->sink->sample_spec); 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: { case SINK_MESSAGE_UPDATE_LATENCY: {
pa_usec_t x, y, latency = (pa_usec_t) offset; 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); y = pa_bytes_to_usec(u->thread_info.counter, &u->sink->sample_spec);
if (y > latency) if (y > latency)

View file

@ -145,14 +145,14 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
case PA_SINK_SUSPENDED: case PA_SINK_SUSPENDED:
pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state));
pa_smoother_pause(u->smoother, pa_rtclock_usec()); pa_smoother_pause(u->smoother, pa_rtclock_now());
break; break;
case PA_SINK_IDLE: case PA_SINK_IDLE:
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
if (u->sink->thread_info.state == PA_SINK_SUSPENDED) if (u->sink->thread_info.state == PA_SINK_SUSPENDED)
pa_smoother_resume(u->smoother, pa_rtclock_usec(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE);
break; break;
@ -167,7 +167,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
case PA_SINK_MESSAGE_GET_LATENCY: { case PA_SINK_MESSAGE_GET_LATENCY: {
pa_usec_t w, r; pa_usec_t w, r;
r = pa_smoother_get(u->smoother, pa_rtclock_usec()); r = pa_smoother_get(u->smoother, pa_rtclock_now());
w = pa_bytes_to_usec((uint64_t) u->offset + u->memchunk.length, &u->sink->sample_spec); w = pa_bytes_to_usec((uint64_t) u->offset + u->memchunk.length, &u->sink->sample_spec);
*((pa_usec_t*) data) = w > r ? w - r : 0; *((pa_usec_t*) data) = w > r ? w - r : 0;
@ -202,7 +202,7 @@ static void thread_func(void *userdata) {
pa_thread_mq_install(&u->thread_mq); pa_thread_mq_install(&u->thread_mq);
pa_rtpoll_install(u->rtpoll); pa_rtpoll_install(u->rtpoll);
pa_smoother_set_time_offset(u->smoother, pa_rtclock_usec()); pa_smoother_set_time_offset(u->smoother, pa_rtclock_now());
for (;;) { for (;;) {
int ret; int ret;
@ -295,7 +295,7 @@ static void thread_func(void *userdata) {
else else
usec = 0; usec = 0;
pa_smoother_put(u->smoother, pa_rtclock_usec(), usec); pa_smoother_put(u->smoother, pa_rtclock_now(), usec);
} }
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */

View file

@ -101,14 +101,14 @@ static int sink_process_msg(
case PA_SINK_MESSAGE_SET_STATE: case PA_SINK_MESSAGE_SET_STATE:
if (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING) if (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING)
u->timestamp = pa_rtclock_usec(); u->timestamp = pa_rtclock_now();
break; break;
case PA_SINK_MESSAGE_GET_LATENCY: { case PA_SINK_MESSAGE_GET_LATENCY: {
pa_usec_t now; pa_usec_t now;
now = pa_rtclock_usec(); now = pa_rtclock_now();
*((pa_usec_t*) data) = u->timestamp > now ? u->timestamp - now : 0ULL; *((pa_usec_t*) data) = u->timestamp > now ? u->timestamp - now : 0ULL;
return 0; return 0;
@ -210,7 +210,7 @@ static void thread_func(void *userdata) {
pa_thread_mq_install(&u->thread_mq); pa_thread_mq_install(&u->thread_mq);
pa_rtpoll_install(u->rtpoll); pa_rtpoll_install(u->rtpoll);
u->timestamp = pa_rtclock_usec(); u->timestamp = pa_rtclock_now();
for (;;) { for (;;) {
int ret; int ret;
@ -219,7 +219,7 @@ static void thread_func(void *userdata) {
if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) { if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
pa_usec_t now; pa_usec_t now;
now = pa_rtclock_usec(); now = pa_rtclock_now();
if (u->sink->thread_info.rewind_requested) { if (u->sink->thread_info.rewind_requested) {
if (u->sink->thread_info.rewind_nbytes > 0) if (u->sink->thread_info.rewind_nbytes > 0)

View file

@ -101,14 +101,14 @@ static int source_process_msg(
case PA_SOURCE_MESSAGE_SET_STATE: case PA_SOURCE_MESSAGE_SET_STATE:
if (PA_PTR_TO_UINT(data) == PA_SOURCE_RUNNING) if (PA_PTR_TO_UINT(data) == PA_SOURCE_RUNNING)
u->timestamp = pa_rtclock_usec(); u->timestamp = pa_rtclock_now();
break; break;
case PA_SOURCE_MESSAGE_GET_LATENCY: { case PA_SOURCE_MESSAGE_GET_LATENCY: {
pa_usec_t now, left_to_fill; pa_usec_t now, left_to_fill;
now = pa_rtclock_usec(); now = pa_rtclock_now();
left_to_fill = u->timestamp > now ? u->timestamp - now : 0ULL; left_to_fill = u->timestamp > now ? u->timestamp - now : 0ULL;
*((pa_usec_t*) data) = u->block_usec > left_to_fill ? u->block_usec - left_to_fill : 0ULL; *((pa_usec_t*) data) = u->block_usec > left_to_fill ? u->block_usec - left_to_fill : 0ULL;
@ -168,7 +168,7 @@ static void thread_func(void *userdata) {
pa_thread_mq_install(&u->thread_mq); pa_thread_mq_install(&u->thread_mq);
pa_rtpoll_install(u->rtpoll); pa_rtpoll_install(u->rtpoll);
u->timestamp = pa_rtclock_usec(); u->timestamp = pa_rtclock_now();
for (;;) { for (;;) {
int ret; int ret;
@ -176,7 +176,7 @@ static void thread_func(void *userdata) {
if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) { if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
pa_usec_t now; pa_usec_t now;
now = pa_rtclock_usec(); now = pa_rtclock_now();
if (u->timestamp <= now) if (u->timestamp <= now)
process_render(u, now); process_render(u, now);

View file

@ -641,7 +641,7 @@ static void thread_func(void *userdata) {
* Since we cannot modify the size of the output buffer we fake it * Since we cannot modify the size of the output buffer we fake it
* by not filling it more than u->buffer_size. * by not filling it more than u->buffer_size.
*/ */
xtime0 = pa_rtclock_usec(); xtime0 = pa_rtclock_now();
buffered_bytes = get_playback_buffered_bytes(u); buffered_bytes = get_playback_buffered_bytes(u);
if (buffered_bytes >= (uint64_t)u->buffer_size) if (buffered_bytes >= (uint64_t)u->buffer_size)
break; break;

View file

@ -395,7 +395,7 @@ static void check_smoother_status(struct userdata *u, pa_bool_t past) {
pa_assert(u); pa_assert(u);
x = pa_rtclock_usec(); x = pa_rtclock_now();
/* Correct by the time the requested issued needs to travel to the /* Correct by the time the requested issued needs to travel to the
* other side. This is a valid thread-safe access, because the * other side. This is a valid thread-safe access, because the
@ -500,7 +500,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
pa_usec_t yl, yr, *usec = data; pa_usec_t yl, yr, *usec = data;
yl = pa_bytes_to_usec((uint64_t) u->counter, &u->sink->sample_spec); yl = pa_bytes_to_usec((uint64_t) u->counter, &u->sink->sample_spec);
yr = pa_smoother_get(u->smoother, pa_rtclock_usec()); yr = pa_smoother_get(u->smoother, pa_rtclock_now());
*usec = yl > yr ? yl - yr : 0; *usec = yl > yr ? yl - yr : 0;
return 0; return 0;
@ -533,7 +533,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
else else
y = 0; y = 0;
pa_smoother_put(u->smoother, pa_rtclock_usec(), y); pa_smoother_put(u->smoother, pa_rtclock_now(), y);
/* We can access this freely here, since the main thread is waiting for us */ /* We can access this freely here, since the main thread is waiting for us */
u->thread_transport_usec = u->transport_usec; u->thread_transport_usec = u->transport_usec;
@ -607,7 +607,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
pa_usec_t yr, yl, *usec = data; pa_usec_t yr, yl, *usec = data;
yl = pa_bytes_to_usec((uint64_t) u->counter, &PA_SOURCE(o)->sample_spec); yl = pa_bytes_to_usec((uint64_t) u->counter, &PA_SOURCE(o)->sample_spec);
yr = pa_smoother_get(u->smoother, pa_rtclock_usec()); yr = pa_smoother_get(u->smoother, pa_rtclock_now());
*usec = yr > yl ? yr - yl : 0; *usec = yr > yl ? yr - yl : 0;
return 0; return 0;
@ -633,7 +633,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
y = pa_bytes_to_usec((uint64_t) u->counter, &u->source->sample_spec); y = pa_bytes_to_usec((uint64_t) u->counter, &u->source->sample_spec);
y += (pa_usec_t) offset; y += (pa_usec_t) offset;
pa_smoother_put(u->smoother, pa_rtclock_usec(), y); pa_smoother_put(u->smoother, pa_rtclock_now(), y);
/* We can access this freely here, since the main thread is waiting for us */ /* We can access this freely here, since the main thread is waiting for us */
u->thread_transport_usec = u->transport_usec; u->thread_transport_usec = u->transport_usec;
@ -1825,7 +1825,7 @@ int pa__init(pa_module*m) {
TRUE, TRUE,
TRUE, TRUE,
10, 10,
pa_rtclock_usec(), pa_rtclock_now(),
FALSE); FALSE);
u->ctag = 1; u->ctag = 1;
u->device_index = u->channel = PA_INVALID_INDEX; u->device_index = u->channel = PA_INVALID_INDEX;

View file

@ -181,7 +181,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
case PA_SINK_SUSPENDED: case PA_SINK_SUSPENDED:
pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state)); pa_assert(PA_SINK_IS_OPENED(u->sink->thread_info.state));
pa_smoother_pause(u->smoother, pa_rtclock_usec()); pa_smoother_pause(u->smoother, pa_rtclock_now());
/* Issue a FLUSH if we are connected */ /* Issue a FLUSH if we are connected */
if (u->fd >= 0) { if (u->fd >= 0) {
@ -193,7 +193,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
case PA_SINK_RUNNING: case PA_SINK_RUNNING:
if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { if (u->sink->thread_info.state == PA_SINK_SUSPENDED) {
pa_smoother_resume(u->smoother, pa_rtclock_usec(), TRUE); pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE);
/* The connection can be closed when idle, so check to /* The connection can be closed when idle, so check to
see if we need to reestablish it */ see if we need to reestablish it */
@ -216,7 +216,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
case PA_SINK_MESSAGE_GET_LATENCY: { case PA_SINK_MESSAGE_GET_LATENCY: {
pa_usec_t w, r; pa_usec_t w, r;
r = pa_smoother_get(u->smoother, pa_rtclock_usec()); r = pa_smoother_get(u->smoother, pa_rtclock_now());
w = pa_bytes_to_usec((u->offset - u->encoding_overhead + (u->encoded_memchunk.length / u->encoding_ratio)), &u->sink->sample_spec); w = pa_bytes_to_usec((u->offset - u->encoding_overhead + (u->encoded_memchunk.length / u->encoding_ratio)), &u->sink->sample_spec);
*((pa_usec_t*) data) = w > r ? w - r : 0; *((pa_usec_t*) data) = w > r ? w - r : 0;
@ -325,7 +325,7 @@ static void thread_func(void *userdata) {
pa_thread_mq_install(&u->thread_mq); pa_thread_mq_install(&u->thread_mq);
pa_rtpoll_install(u->rtpoll); pa_rtpoll_install(u->rtpoll);
pa_smoother_set_time_offset(u->smoother, pa_rtclock_usec()); pa_smoother_set_time_offset(u->smoother, pa_rtclock_now());
/* Create a chunk of memory that is our encoded silence sample. */ /* Create a chunk of memory that is our encoded silence sample. */
pa_memchunk_reset(&silence); pa_memchunk_reset(&silence);
@ -465,7 +465,7 @@ static void thread_func(void *userdata) {
else else
usec = 0; usec = 0;
pa_smoother_put(u->smoother, pa_rtclock_usec(), usec); pa_smoother_put(u->smoother, pa_rtclock_now(), usec);
} }
/* Hmm, nothing to do. Let's sleep */ /* Hmm, nothing to do. Let's sleep */

View file

@ -193,7 +193,7 @@ static void sink_input_suspend_within_thread(pa_sink_input* i, pa_bool_t b) {
pa_assert_se(s = i->userdata); pa_assert_se(s = i->userdata);
if (b) { if (b) {
pa_smoother_pause(s->smoother, pa_rtclock_usec()); pa_smoother_pause(s->smoother, pa_rtclock_now());
pa_memblockq_flush_read(s->memblockq); pa_memblockq_flush_read(s->memblockq);
} else } else
s->first_packet = FALSE; s->first_packet = FALSE;

View file

@ -373,7 +373,7 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t
if (!s->smoother) if (!s->smoother)
return; return;
x = pa_rtclock_usec(); x = pa_rtclock_now();
if (s->timing_info_valid) { if (s->timing_info_valid) {
if (aposteriori) if (aposteriori)
@ -1057,7 +1057,7 @@ static int create_stream(
if (flags & PA_STREAM_INTERPOLATE_TIMING) { if (flags & PA_STREAM_INTERPOLATE_TIMING) {
pa_usec_t x; pa_usec_t x;
x = pa_rtclock_usec(); x = pa_rtclock_now();
pa_assert(!s->smoother); pa_assert(!s->smoother);
s->smoother = pa_smoother_new( s->smoother = pa_smoother_new(
@ -1594,7 +1594,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command,
if (o->stream->smoother) { if (o->stream->smoother) {
pa_usec_t u, x; pa_usec_t u, x;
u = x = pa_rtclock_usec() - i->transport_usec; u = x = pa_rtclock_now() - i->transport_usec;
if (o->stream->direction == PA_STREAM_PLAYBACK && o->context->version >= 13) { if (o->stream->direction == PA_STREAM_PLAYBACK && o->context->version >= 13) {
pa_usec_t su; pa_usec_t su;
@ -2103,7 +2103,7 @@ int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec) {
PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_RECORD || !s->timing_info.write_index_corrupt, PA_ERR_NODATA); PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_RECORD || !s->timing_info.write_index_corrupt, PA_ERR_NODATA);
if (s->smoother) if (s->smoother)
usec = pa_smoother_get(s->smoother, pa_rtclock_usec()); usec = pa_smoother_get(s->smoother, pa_rtclock_now());
else else
usec = calc_time(s, FALSE); usec = calc_time(s, FALSE);

View file

@ -294,7 +294,7 @@ void pa_log_levelv_meta(
static pa_usec_t start, last; static pa_usec_t start, last;
pa_usec_t u, a, r; pa_usec_t u, a, r;
u = pa_rtclock_usec(); u = pa_rtclock_now();
PA_ONCE_BEGIN { PA_ONCE_BEGIN {
start = u; start = u;

View file

@ -38,7 +38,7 @@ pa_bool_t pa_ratelimit_test(pa_ratelimit *r) {
pa_usec_t now; pa_usec_t now;
pa_mutex *m; pa_mutex *m;
now = pa_rtclock_usec(); now = pa_rtclock_now();
m = pa_static_mutex_get(&mutex, FALSE, FALSE); m = pa_static_mutex_get(&mutex, FALSE, FALSE);
pa_mutex_lock(m); pa_mutex_lock(m);

View file

@ -122,7 +122,7 @@ void pa_rtclock_hrtimer_enable(void) {
#endif #endif
} }
pa_usec_t pa_rtclock_usec(void) { pa_usec_t pa_rtclock_now(void) {
struct timeval tv; struct timeval tv;
return pa_timeval_load(pa_rtclock_get(&tv)); return pa_timeval_load(pa_rtclock_get(&tv));

View file

@ -31,7 +31,7 @@ struct timeval;
struct timeval *pa_rtclock_get(struct timeval *ts); struct timeval *pa_rtclock_get(struct timeval *ts);
pa_usec_t pa_rtclock_usec(void); pa_usec_t pa_rtclock_now(void);
pa_usec_t pa_rtclock_age(const struct timeval *tv); pa_usec_t pa_rtclock_age(const struct timeval *tv);
pa_bool_t pa_rtclock_hrtimer(void); pa_bool_t pa_rtclock_hrtimer(void);

View file

@ -160,7 +160,7 @@ pa_rtpoll *pa_rtpoll_new(void) {
PA_LLIST_HEAD_INIT(pa_rtpoll_item, p->items); PA_LLIST_HEAD_INIT(pa_rtpoll_item, p->items);
#ifdef DEBUG_TIMING #ifdef DEBUG_TIMING
p->timestamp = pa_rtclock_usec(); p->timestamp = pa_rtclock_now();
p->slept = p->awake = 0; p->slept = p->awake = 0;
#endif #endif
@ -394,7 +394,7 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
#ifdef DEBUG_TIMING #ifdef DEBUG_TIMING
{ {
pa_usec_t now = pa_rtclock_usec(); pa_usec_t now = pa_rtclock_now();
p->awake = now - p->timestamp; p->awake = now - p->timestamp;
p->timestamp = now; p->timestamp = now;
} }
@ -421,7 +421,7 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait) {
#ifdef DEBUG_TIMING #ifdef DEBUG_TIMING
{ {
pa_usec_t now = pa_rtclock_usec(); pa_usec_t now = pa_rtclock_now();
p->slept = now - p->timestamp; p->slept = now - p->timestamp;
p->timestamp = now; p->timestamp = now;