summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-11 19:58:17 +0200
committerwm4 <wm4@nowhere>2019-10-11 20:02:23 +0200
commit89c717559b4b162fecc581190774907922609e91 (patch)
tree01958658251313f4ad44f3a79823e2dced67189f
parent1723b88cdde6fb773c23e70e98686ddac8ee1add (diff)
downloadmpv-89c717559b4b162fecc581190774907922609e91.tar.bz2
mpv-89c717559b4b162fecc581190774907922609e91.tar.xz
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
-rw-r--r--audio/out/pull.c4
1 files 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);