1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 00:42:57 +00:00

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: c5a82f729b
This commit is contained in:
wm4 2019-10-11 19:58:17 +02:00
parent 1723b88cdd
commit 89c717559b

View File

@ -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);