summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2012-08-30 07:48:01 +0000
committerratchov <ratchov@openbsd.org>2012-08-30 07:48:01 +0000
commitcb4c6aab54a242370014cbb4da5f74cc3d0bbce0 (patch)
tree43a5afe9ad4f80925cb768c7726426f5c72c32e5
parentrfc 5905 replaces rfc 2030; for now, the reference to 2030 in ntpd.conf (diff)
downloadwireguard-openbsd-cb4c6aab54a242370014cbb4da5f74cc3d0bbce0.tar.xz
wireguard-openbsd-cb4c6aab54a242370014cbb4da5f74cc3d0bbce0.zip
Use (rate / 15) as block size in off-line mode to ensure the
block size stays below SHORT_MAX. Found by sthen@
-rw-r--r--usr.bin/aucat/dev.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/aucat/dev.c b/usr.bin/aucat/dev.c
index 47076b1ca85..5e050b211d8 100644
--- a/usr.bin/aucat/dev.c
+++ b/usr.bin/aucat/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.80 2012/05/23 19:14:02 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.81 2012/08/30 07:48:01 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -373,7 +373,12 @@ dev_open(struct dev *d)
d->ipar = par;
d->opar = par;
d->rate = rate;
- d->round = rate;
+ /*
+ * block sizes in the resampling code are limited to
+ * 2^15, so use 1/15 of the rate, since all standard
+ * sample rates are multiple of 15
+ */
+ d->round = rate / 15;
d->bufsz = 2 * d->round;
}
#ifdef DEBUG