summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-02-05 14:26:27 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-02-05 14:26:27 +0000
commit49796fcd0679137b0b3af167629cfc3c4b112999 (patch)
tree0c17311a8c86a9c5032d2baba58cfcee85c4fbb4
parenta9bc28e98af568e37630403b384e8f207331715b (diff)
Fix confusion between minimum and maximum samples-per-frame.
This may fix rare stuttering caused by underruns in case device clock drifts with respect to the bus clock.
-rw-r--r--sys/dev/usb/uaudio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index a950308ba8e..6ae07fa6026 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uaudio.c,v 1.146 2019/09/05 05:38:40 ratchov Exp $ */
+/* $OpenBSD: uaudio.c,v 1.147 2020/02/05 14:26:26 ratchov Exp $ */
/*
* Copyright (c) 2018 Alexandre Ratchov <alex@caoua.org>
*
@@ -2862,7 +2862,7 @@ uaudio_stream_open(struct uaudio_softc *sc, int dir,
*
* UAUDIO_NXFERS * (blksz - min_blksz)
*/
- min_blksz = (((uint64_t)blksz << 32) / s->spf_max * s->spf_max) >> 32;
+ min_blksz = (((uint64_t)blksz << 32) / s->spf_max * s->spf_min) >> 32;
/* round to sample size */
min_blksz -= min_blksz % bpa;