mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
tests: Make loopback latency test more accurate
This makes sure that we always take the timing at the point when we write out the pulse, making the overall latency measurement more accurate.
This commit is contained in:
parent
e001cc1424
commit
c6df40a539
1 changed files with 9 additions and 4 deletions
|
|
@ -54,12 +54,17 @@ static void nop_free_cb(void *p) {
|
||||||
static void write_cb(pa_stream *s, size_t nbytes, void *userdata) {
|
static void write_cb(pa_stream *s, size_t nbytes, void *userdata) {
|
||||||
pa_lo_test_context *ctx = (pa_lo_test_context *) userdata;
|
pa_lo_test_context *ctx = (pa_lo_test_context *) userdata;
|
||||||
static int ppos = 0;
|
static int ppos = 0;
|
||||||
int r, nsamp = nbytes / ctx->fs;
|
int r, nsamp;
|
||||||
|
|
||||||
|
/* Get the real requested bytes since the last write might have been
|
||||||
|
* incomplete if it caused a wrap around */
|
||||||
|
nbytes = pa_stream_writable_size(s);
|
||||||
|
nsamp = nbytes / ctx->fs;
|
||||||
|
|
||||||
if (ppos + nsamp > N_OUT) {
|
if (ppos + nsamp > N_OUT) {
|
||||||
r = pa_stream_write(s, &out[ppos][0], (N_OUT - ppos) * ctx->fs, nop_free_cb, 0, PA_SEEK_RELATIVE);
|
/* Wrap-around, write to end and exit. Next iteration will fill up the
|
||||||
nbytes -= (N_OUT - ppos) * ctx->fs;
|
* rest */
|
||||||
ppos = 0;
|
nbytes = (N_OUT - ppos) * ctx->fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppos == 0)
|
if (ppos == 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue