diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-07-18 18:34:33 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-07-18 18:34:33 +0000 |
commit | ae50470e6b1b394f8723beaa9a529da47199d5b3 (patch) | |
tree | 52797965d2ede26bff40454e51c405c17dbc7d78 | |
parent | f96f4359e5d16d4ee820e670335e29bb9a2180d5 (diff) |
move the processing of the pause attribute to the end of audiosetinfo(),
to allow buffer sizes and pointer to the buffer to be set to reasonable
values for the sample size of the data to be read/written.
fixes kernel corruption seen with azalia and probably other drivers
that are using something other than 8kHz monaural mulaw as the default
encoding when doing 'dd if=/dev/audio of=foo' as the first audio
operation after boot.
problem reported by deanna@
-rw-r--r-- | sys/dev/audio.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 02eb1c213b3..3bc8299ddc8 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.66 2007/07/17 22:59:19 jakemsr Exp $ */ +/* $OpenBSD: audio.c,v 1.67 2007/07/18 18:34:32 jakemsr Exp $ */ /* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */ /* @@ -2611,27 +2611,6 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai) return(error); } - if (p->pause != (u_char)~0) { - sc->sc_pr.pause = p->pause; - if (!p->pause && !sc->sc_pbus && (sc->sc_mode & AUMODE_PLAY)) { - s = splaudio(); - error = audiostartp(sc); - splx(s); - if (error) - return error; - } - } - if (r->pause != (u_char)~0) { - sc->sc_rr.pause = r->pause; - if (!r->pause && !sc->sc_rbus && (sc->sc_mode & AUMODE_RECORD)) { - s = splaudio(); - error = audiostartr(sc); - splx(s); - if (error) - return error; - } - } - if (ai->blocksize != ~0) { /* Block size specified explicitly. */ if (!cleared) @@ -2708,6 +2687,27 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai) sc->sc_pr.usedlow = sc->sc_pr.usedhigh - sc->sc_pr.blksize; } + if (p->pause != (u_char)~0) { + sc->sc_pr.pause = p->pause; + if (!p->pause && !sc->sc_pbus && (sc->sc_mode & AUMODE_PLAY)) { + s = splaudio(); + error = audiostartp(sc); + splx(s); + if (error) + return error; + } + } + if (r->pause != (u_char)~0) { + sc->sc_rr.pause = r->pause; + if (!r->pause && !sc->sc_rbus && (sc->sc_mode & AUMODE_RECORD)) { + s = splaudio(); + error = audiostartr(sc); + splx(s); + if (error) + return error; + } + } + return (0); } |