diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-02-28 09:15:05 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-02-28 09:15:05 +0000 |
commit | a83361e59eca6b9ecbbfacb0af2f1371153d239a (patch) | |
tree | ac241df1f6d418632a2f2d0c8675d1d1e7b87ba1 /sys/dev | |
parent | c81b460af3aa011977cadc5b4e8b61807a390165 (diff) |
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')
-rw-r--r-- | sys/dev/audio.c | 13 |
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) |