Line 0
Link Here
|
|
|
1 |
Bug 1153179 - fix latency reporting in libcubeb sndio |
2 |
|
3 |
--- media/libcubeb/src/cubeb_sndio.c.orig 2017-01-12 17:53:15 UTC |
4 |
+++ media/libcubeb/src/cubeb_sndio.c |
5 |
@@ -67,7 +67,7 @@ sndio_onmove(void *arg, int delta) |
6 |
{ |
7 |
cubeb_stream *s = (cubeb_stream *)arg; |
8 |
|
9 |
- s->rdpos += delta; |
10 |
+ s->rdpos += delta * s->bpf; |
11 |
} |
12 |
|
13 |
static void * |
14 |
@@ -135,7 +135,7 @@ sndio_mainloop(void *arg) |
15 |
state = CUBEB_STATE_ERROR; |
16 |
break; |
17 |
} |
18 |
- s->wrpos = 0; |
19 |
+ s->wrpos += n; |
20 |
start += n; |
21 |
} |
22 |
} |
23 |
@@ -326,7 +336,7 @@ sndio_stream_get_position(cubeb_stream * |
24 |
{ |
25 |
pthread_mutex_lock(&s->mtx); |
26 |
DPR("sndio_stream_get_position() %lld\n", s->rdpos); |
27 |
- *p = s->rdpos; |
28 |
+ *p = s->rdpos / s->bpf; |
29 |
pthread_mutex_unlock(&s->mtx); |
30 |
return CUBEB_OK; |
31 |
} |
32 |
@@ -346,7 +356,7 @@ sndio_stream_get_latency(cubeb_stream * |
33 |
{ |
34 |
// http://www.openbsd.org/cgi-bin/man.cgi?query=sio_open |
35 |
// in the "Measuring the latency and buffers usage" paragraph. |
36 |
- *latency = stm->wrpos - stm->rdpos; |
37 |
+ *latency = (stm->wrpos - stm->rdpos) / stm->bpf; |
38 |
return CUBEB_OK; |
39 |
} |
40 |
|