mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-21 08:56:46 -05:00
support for latency interpolation
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@256 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
da45617efc
commit
148202d432
13 changed files with 250 additions and 72 deletions
|
|
@ -297,7 +297,8 @@ static void exit_signal_callback(struct pa_mainloop_api*m, struct pa_signal_even
|
|||
|
||||
/* Show the current latency */
|
||||
static void stream_get_latency_callback(struct pa_stream *s, const struct pa_latency_info *i, void *userdata) {
|
||||
double total;
|
||||
pa_usec_t total;
|
||||
int negative = 0;
|
||||
assert(s);
|
||||
|
||||
if (!i) {
|
||||
|
|
@ -306,20 +307,17 @@ static void stream_get_latency_callback(struct pa_stream *s, const struct pa_lat
|
|||
return;
|
||||
}
|
||||
|
||||
if (mode == PLAYBACK)
|
||||
total = (double) i->sink_usec + i->buffer_usec + i->transport_usec;
|
||||
else
|
||||
total = (double) i->source_usec + i->buffer_usec + i->transport_usec - i->sink_usec;
|
||||
total = pa_stream_get_latency(s, i, &negative);
|
||||
|
||||
fprintf(stderr, "Latency: buffer: %0.0f usec; sink: %0.0f usec; source: %0.0f usec; transport: %0.0f usec; total: %0.0f usec; synchronized clocks: %s.\n",
|
||||
(float) i->buffer_usec, (float) i->sink_usec, (float) i->source_usec, (float) i->transport_usec, total,
|
||||
(float) i->buffer_usec, (float) i->sink_usec, (float) i->source_usec, (float) i->transport_usec, (float) total * (negative?-1:1),
|
||||
i->synchronized_clocks ? "yes" : "no");
|
||||
}
|
||||
|
||||
/* Someone requested that the latency is shown */
|
||||
static void sigusr1_signal_callback(struct pa_mainloop_api*m, struct pa_signal_event *e, int sig, void *userdata) {
|
||||
fprintf(stderr, "Got SIGUSR1, requesting latency.\n");
|
||||
pa_operation_unref(pa_stream_get_latency(stream, stream_get_latency_callback, NULL));
|
||||
pa_operation_unref(pa_stream_get_latency_info(stream, stream_get_latency_callback, NULL));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue