Added
Link Here
|
1 |
$OpenBSD: patch-media_libcubeb_src_cubeb_sndio_c,v 1.3 2016/04/27 13:50:27 landry Exp $ |
2 |
|
3 |
https://github.com/kinetiknz/cubeb/commit/af33b71675a90b501c7510bb793c10bbc27642b0 |
4 |
https://github.com/kinetiknz/cubeb/commit/658d7eba38d4b8de932dba367165834b8ac9c130 |
5 |
|
6 |
--- media/libcubeb/src/cubeb_sndio.c.orig Mon Mar 28 19:56:03 2016 |
7 |
+++ media/libcubeb/src/cubeb_sndio.c Mon Mar 28 19:57:27 2016 |
8 |
@@ -67,7 +67,7 @@ sndio_onmove(void *arg, int delta) |
9 |
{ |
10 |
cubeb_stream *s = (cubeb_stream *)arg; |
11 |
|
12 |
- s->rdpos += delta; |
13 |
+ s->rdpos += delta * s->bpf; |
14 |
} |
15 |
|
16 |
static void * |
17 |
@@ -135,7 +135,7 @@ sndio_mainloop(void *arg) |
18 |
state = CUBEB_STATE_ERROR; |
19 |
break; |
20 |
} |
21 |
- s->wrpos = 0; |
22 |
+ s->wrpos += n; |
23 |
start += n; |
24 |
} |
25 |
} |
26 |
@@ -197,7 +197,7 @@ sndio_stream_init(cubeb * context, |
27 |
if (s == NULL) |
28 |
return CUBEB_ERROR; |
29 |
s->context = context; |
30 |
- s->hdl = sio_open(NULL, SIO_PLAY, 0); |
31 |
+ s->hdl = sio_open(NULL, SIO_PLAY, 1); |
32 |
if (s->hdl == NULL) { |
33 |
free(s); |
34 |
DPR("sndio_stream_init(), sio_open() failed\n"); |
35 |
@@ -336,7 +336,7 @@ sndio_stream_get_position(cubeb_stream *s, uint64_t *p |
36 |
{ |
37 |
pthread_mutex_lock(&s->mtx); |
38 |
DPR("sndio_stream_get_position() %lld\n", s->rdpos); |
39 |
- *p = s->rdpos; |
40 |
+ *p = s->rdpos / s->bpf; |
41 |
pthread_mutex_unlock(&s->mtx); |
42 |
return CUBEB_OK; |
43 |
} |
44 |
@@ -356,7 +356,7 @@ sndio_stream_get_latency(cubeb_stream * stm, uint32_t |
45 |
{ |
46 |
// http://www.openbsd.org/cgi-bin/man.cgi?query=sio_open |
47 |
// in the "Measuring the latency and buffers usage" paragraph. |
48 |
- *latency = stm->wrpos - stm->rdpos; |
49 |
+ *latency = (stm->wrpos - stm->rdpos) / stm->bpf; |
50 |
return CUBEB_OK; |
51 |
} |
52 |
|