From af45fb65afca161633409e51b83cdb8e3e7c2b5c Mon Sep 17 00:00:00 2001 From: Ted Ying Date: Thu, 1 Jun 2017 18:00:20 -0400 Subject: [PATCH] Change latency estimation to account for already-read data in pa_simple_get_latency(). BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=81075 --- src/pulse/simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pulse/simple.c b/src/pulse/simple.c index 614f4f7..c8e89b0 100644 --- a/src/pulse/simple.c +++ b/src/pulse/simple.c @@ -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) -- 2.9.4