simple: Change latency estimation to account for already-read data in pa_simple_get_l...
authorTed Ying <yingted@gmail.com>
Thu, 1 Jun 2017 22:00:20 +0000 (18:00 -0400)
committerTanu Kaskinen <tanuk@iki.fi>
Thu, 20 Jul 2017 13:50:08 +0000 (16:50 +0300)
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=81075
src/pulse/simple.c

index 614f4f7..c8e89b0 100644 (file)
@@ -466,7 +466,7 @@ pa_usec_t pa_simple_get_latency(pa_simple *p, int *rerror) {
             pa_usec_t extra = 0;
 
             if (p->direction == PA_STREAM_RECORD)
-                extra = pa_bytes_to_usec(p->read_length, pa_stream_get_sample_spec(p->stream));
+                extra = -pa_bytes_to_usec(p->read_index, pa_stream_get_sample_spec(p->stream));
 
             if (negative) {
                 if (extra > t)