summaryrefslogtreecommitdiffstats
path: root/sys/dev/audio.c
diff options
context:
space:
mode:
authorjakemsr <jakemsr@openbsd.org>2008-02-28 09:15:04 +0000
committerjakemsr <jakemsr@openbsd.org>2008-02-28 09:15:04 +0000
commit86be20b4a1122c4ea7813916f829e884028d1d95 (patch)
tree8dbc70296768167ed4edc3c6fb1790dbdf44c96f /sys/dev/audio.c
parentmention the Sun part # for their PCI-X adapter. (diff)
downloadwireguard-openbsd-86be20b4a1122c4ea7813916f829e884028d1d95.tar.xz
wireguard-openbsd-86be20b4a1122c4ea7813916f829e884028d1d95.zip
from audio(4):
blocksize sets the current audio blocksize. The generic audio driver layer and the hardware driver have the opportunity to ad- just this block size to get it within implementation-required limits. Upon return from an AUDIO_SETINFO call, the actual blocksize set is returned in this field. Normally the blocksize is calculated to correspond to 50ms of sound and it is recalcu- lated when the encoding parameter changes, but if the blocksize is set explicitly this value becomes sticky, i.e., it remains even when the encoding is changed. The stickiness can be cleared by reopening the device or setting the blocksize to 0. however, there were insufficient checks to make the blocksize is actually sticky once it is set by the user. this adds them. ok ratchov@
Diffstat (limited to 'sys/dev/audio.c')
-rw-r--r--sys/dev/audio.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index f1988319a37..2202a91ca7e 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.89 2007/11/17 13:31:30 ratchov Exp $ */
+/* $OpenBSD: audio.c,v 1.90 2008/02/28 09:15:04 jakemsr Exp $ */
/* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */
/*
@@ -2735,6 +2735,7 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
oldpblksize = sc->sc_pr.blksize;
oldrblksize = sc->sc_rr.blksize;
if (ai->blocksize != ~0) {
+ sc->sc_blkset = 0;
if (!cleared)
audio_clear(sc);
cleared = 1;
@@ -2748,8 +2749,8 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
fs = rp.channels * (rp.precision / 8) * rp.factor;
fpb = ai->blocksize / fs;
}
- audio_set_blksize(sc, AUMODE_RECORD, fpb);
- sc->sc_blkset = 1;
+ if (sc->sc_blkset == 0)
+ audio_set_blksize(sc, AUMODE_RECORD, fpb);
}
if (np) {
if (ai->blocksize == ~0 || ai->blocksize == 0) {
@@ -2758,9 +2759,11 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
fs = pp.channels * (pp.precision / 8) * pp.factor;
fpb = ai->blocksize / fs;
}
- audio_set_blksize(sc, AUMODE_PLAY, fpb);
- sc->sc_blkset = 1;
+ if (sc->sc_blkset == 0)
+ audio_set_blksize(sc, AUMODE_PLAY, fpb);
}
+ if ((ai->blocksize != ~0) && (ai->blocksize != 0))
+ sc->sc_blkset = 1;
#ifdef AUDIO_DEBUG
if (audiodebug > 1 && nr)