From 89c717559b4b162fecc581190774907922609e91 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 11 Oct 2019 19:58:17 +0200 Subject: audio/out/pull: fix underflow reporting I think this was _always_ wrong. Due to the line above the first changed line, buffered_bytes==bytes always. I can only hope I broke this in a less under-tested edit when I originally wrote this. Fixes: c5a82f729bd097 --- audio/out/pull.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/out/pull.c b/audio/out/pull.c index a4aa53821e..c6125bd8bc 100644 --- a/audio/out/pull.c +++ b/audio/out/pull.c @@ -153,8 +153,8 @@ int ao_read_data(struct ao *ao, void **data, int samples, int64_t out_time_us) int buffered_bytes = mp_ring_buffered(p->buffers[0]); bytes = MPMIN(buffered_bytes, full_bytes); - if (buffered_bytes < bytes && !atomic_load(&p->draining)) - atomic_fetch_add(&p->underflow, (bytes - buffered_bytes) / ao->sstride); + if (full_bytes > bytes && !atomic_load(&p->draining)) + atomic_fetch_add(&p->underflow, (full_bytes - bytes) / ao->sstride); if (bytes > 0) atomic_store(&p->end_time_us, out_time_us); -- cgit v1.2.3