View | Details | Raw Unified | Return to bug 215867 | Differences between
and this patch

Collapse All | Expand All

(-)b/www/firefox-esr/files/patch-media_libcubeb_src_cubeb__sndio.c (+51 lines)
Added Link Here
1
--- media/libcubeb/src/cubeb_sndio.c.orig	2017-01-12 17:53:15 UTC
2
+++ media/libcubeb/src/cubeb_sndio.c
3
@@ -67,7 +67,7 @@ sndio_onmove(void *arg, int delta)
4
 {
5
   cubeb_stream *s = (cubeb_stream *)arg;
6
 
7
-  s->rdpos += delta;
8
+  s->rdpos += delta * s->bpf;
9
 }
10
 
11
 static void *
12
@@ -135,7 +135,7 @@ sndio_mainloop(void *arg)
13
         state = CUBEB_STATE_ERROR;
14
         break;
15
       }
16
-      s->wrpos = 0;
17
+      s->wrpos += n;
18
       start += n;
19
     }
20
   }
21
@@ -277,10 +287,10 @@ sndio_get_preferred_sample_rate(cubeb * 
22
 }
23
 
24
 static int
25
-sndio_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * latency_ms)
26
+sndio_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * latency_frames)
27
 {
28
   // XXX Not yet implemented.
29
-  *latency_ms = 40;
30
+  *latency_frames = 2048;
31
 
32
   return CUBEB_OK;
33
 }
34
@@ -326,7 +336,7 @@ sndio_stream_get_position(cubeb_stream *
35
 {
36
   pthread_mutex_lock(&s->mtx);
37
   DPR("sndio_stream_get_position() %lld\n", s->rdpos);
38
-  *p = s->rdpos;
39
+  *p = s->rdpos / s->bpf;
40
   pthread_mutex_unlock(&s->mtx);
41
   return CUBEB_OK;
42
 }
43
@@ -346,7 +356,7 @@ sndio_stream_get_latency(cubeb_stream * 
44
 {
45
   // http://www.openbsd.org/cgi-bin/man.cgi?query=sio_open
46
   // in the "Measuring the latency and buffers usage" paragraph.
47
-  *latency = stm->wrpos - stm->rdpos;
48
+  *latency = (stm->wrpos - stm->rdpos) / stm->bpf;
49
   return CUBEB_OK;
50
 }
51
 

Return to bug 215867