diff options
author | Alexandre Ratchov <[email protected]> | 2016-03-07 11:21:58 +0100 |
---|---|---|
committer | Landry Breuil <[email protected]> | 2016-03-07 11:21:58 +0100 |
commit | af33b71675a90b501c7510bb793c10bbc27642b0 (patch) | |
tree | 36b69d97dd0e12eb7b64c53847fd853dba3ec528 /src/cubeb_sndio.c | |
parent | 658d7eba38d4b8de932dba367165834b8ac9c130 (diff) | |
download | cubeb-af33b71675a90b501c7510bb793c10bbc27642b0.tar.gz cubeb-af33b71675a90b501c7510bb793c10bbc27642b0.zip |
Bug 1153179 - fix latency reporting in libcubeb sndio
Diffstat (limited to 'src/cubeb_sndio.c')
-rw-r--r-- | src/cubeb_sndio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cubeb_sndio.c b/src/cubeb_sndio.c index 341cc32..2b3242b 100644 --- a/src/cubeb_sndio.c +++ b/src/cubeb_sndio.c @@ -67,7 +67,7 @@ sndio_onmove(void *arg, int delta) { cubeb_stream *s = (cubeb_stream *)arg; - s->rdpos += delta; + s->rdpos += delta * s->bpf; } static void * @@ -135,7 +135,7 @@ sndio_mainloop(void *arg) state = CUBEB_STATE_ERROR; break; } - s->wrpos = 0; + s->wrpos += n; start += n; } } @@ -336,7 +336,7 @@ sndio_stream_get_position(cubeb_stream *s, uint64_t *p) { pthread_mutex_lock(&s->mtx); DPR("sndio_stream_get_position() %lld\n", s->rdpos); - *p = s->rdpos; + *p = s->rdpos / s->bpf; pthread_mutex_unlock(&s->mtx); return CUBEB_OK; } @@ -356,7 +356,7 @@ sndio_stream_get_latency(cubeb_stream * stm, uint32_t * latency) { // http://www.openbsd.org/cgi-bin/man.cgi?query=sio_open // in the "Measuring the latency and buffers usage" paragraph. - *latency = stm->wrpos - stm->rdpos; + *latency = (stm->wrpos - stm->rdpos) / stm->bpf; return CUBEB_OK; } |