summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/audio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index ab0a1dca01c..9765b1d11a9 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.167 2018/01/10 09:03:26 ratchov Exp $ */
+/* $OpenBSD: audio.c,v 1.168 2018/03/21 07:02:02 ratchov Exp $ */
/*
* Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org>
*
@@ -462,7 +462,7 @@ audio_rintr(void *addr)
sc->rec.pos += sc->rec.blksz;
audio_buf_wcommit(&sc->rec, sc->rec.blksz);
- if (sc->rec.used == sc->rec.len) {
+ if (sc->rec.used > sc->rec.len - sc->rec.blksz) {
DPRINTFN(1, "%s: rec overrun\n", DEVNAME(sc));
sc->rec.xrun += sc->rec.blksz;
audio_buf_rdiscard(&sc->rec, sc->rec.blksz);