Merge Pierre's changes

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@445 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-01-10 17:51:06 +00:00
parent 80ae72ce45
commit f7a99e9047
65 changed files with 3786 additions and 1050 deletions

View file

@ -66,6 +66,7 @@ struct pa_stream *pa_stream_new(struct pa_context *c, const char *name, const st
s->counter = 0;
s->previous_time = 0;
s->previous_ipol_time = 0;
s->corked = 0;
s->interpolate = 0;
@ -217,7 +218,7 @@ static void ipol_callback(struct pa_mainloop_api *m, struct pa_time_event *e, co
s->ipol_requested = 1;
}
gettimeofday(&tv2, NULL);
pa_gettimeofday(&tv2);
pa_timeval_add(&tv2, LATENCY_IPOL_INTERVAL_USEC);
m->time_restart(e, &tv2);
@ -256,7 +257,7 @@ void pa_create_stream_callback(struct pa_pdispatch *pd, uint32_t command, uint32
struct timeval tv;
pa_operation_unref(pa_stream_get_latency_info(s, NULL, NULL));
gettimeofday(&tv, NULL);
pa_gettimeofday(&tv);
tv.tv_usec += LATENCY_IPOL_INTERVAL_USEC; /* every 100 ms */
assert(!s->ipol_event);
@ -412,7 +413,7 @@ static void stream_get_latency_info_callback(struct pa_pdispatch *pd, uint32_t c
pa_context_fail(o->context, PA_ERROR_PROTOCOL);
goto finish;
} else {
gettimeofday(&now, NULL);
pa_gettimeofday(&now);
if (pa_timeval_cmp(&local, &remote) <= 0 && pa_timeval_cmp(&remote, &now) <= 0) {
/* local and remote seem to have synchronized clocks */
@ -470,7 +471,7 @@ struct pa_operation* pa_stream_get_latency_info(struct pa_stream *s, void (*cb)(
pa_tagstruct_putu32(t, tag = s->context->ctag++);
pa_tagstruct_putu32(t, s->channel);
gettimeofday(&now, NULL);
pa_gettimeofday(&now);
pa_tagstruct_put_timeval(t, &now);
pa_tagstruct_putu64(t, s->counter);
@ -581,7 +582,7 @@ struct pa_operation* pa_stream_cork(struct pa_stream *s, int b, void (*cb) (stru
s->ipol_usec = pa_stream_get_interpolated_time(s);
else if (s->corked && !b)
/* Unpausing */
gettimeofday(&s->ipol_timestamp, NULL);
pa_gettimeofday(&s->ipol_timestamp);
}
s->corked = b;
@ -702,7 +703,7 @@ pa_usec_t pa_stream_get_time(struct pa_stream *s, const struct pa_latency_info *
usec = s->previous_time;
s->previous_time = usec;
return usec;
}
@ -762,10 +763,11 @@ pa_usec_t pa_stream_get_interpolated_time(struct pa_stream *s) {
usec = s->ipol_usec + pa_timeval_age(&s->ipol_timestamp);
}
if (usec < s->previous_time)
usec = s->previous_time;
if (usec < s->previous_ipol_time)
usec = s->previous_ipol_time;
s->previous_ipol_time = usec;
s->previous_time = usec;
return usec;
}