diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-07-06 04:10:35 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-07-06 04:10:35 +0000 |
commit | 067c425101eda3d6b956f9d0eef6602958d4cfda (patch) | |
tree | 15604b45d4db828074b77fdd09478edf52421620 | |
parent | be5066ce5b065fbdd61bd469418b7d591674a31b (diff) |
- there is no need for audio_init_ringbuffer() to always set the "pause"
attribute to '0'. this function may be called when executing an
AUDIO_SETINFO ioctl where the pause attribute was set to '1', and
setting it to '0' in this function will cause unexpected bahaviour.
- according to audio(4), the AUDIO_FLUSH ioctl "restarts recording
and playback". therefor, it should set the pause attributes to '0'.
this was previously accomplished indirectly, because it calls
audio_init_ringbuffer(), which was setting pause to '0'.
- the pause attribute must be set to '0' in audio_open() so that
recording and playback buffers can be "activated" when the device
is opened. this was apparently forgotten when audiosetinfo()
was split off of audio_open() and the logic in audiosetinfo()
was changed to accomodate being run at times other than open().
also, this only really affects read() with poll(), which may
explain why the problem was not noticed for some time.
originally part of a patch Alexandre Ratchov sent to tech@ a
while back
fixes PR 3813
"patches look correct to me" marco@
-rw-r--r-- | sys/dev/audio.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index f275ae9de39..e200fbfe7f0 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.56 2007/07/06 03:20:07 jakemsr Exp $ */ +/* $OpenBSD: audio.c,v 1.57 2007/07/06 04:10:34 jakemsr Exp $ */ /* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */ /* @@ -859,7 +859,6 @@ audio_init_ringbuffer(rp) rp->stamp_last = 0; rp->drops = 0; rp->pdrops = 0; - rp->pause = 0; rp->copying = 0; rp->needfill = 0; rp->mmapped = 0; @@ -1044,10 +1043,12 @@ audio_open(dev, sc, flags, ifmt, p) ai.record.encoding = sc->sc_rparams.encoding; ai.record.channels = sc->sc_rparams.channels; ai.record.precision = sc->sc_rparams.precision; + ai.record.pause = 0; ai.play.sample_rate = sc->sc_pparams.sample_rate; ai.play.encoding = sc->sc_pparams.encoding; ai.play.channels = sc->sc_pparams.channels; ai.play.precision = sc->sc_pparams.precision; + ai.play.pause = 0; ai.mode = mode; sc->sc_pr.blksize = sc->sc_rr.blksize = 0; /* force recalculation */ error = audiosetinfo(sc, &ai); @@ -1667,6 +1668,8 @@ audio_ioctl(dev, cmd, addr, flag, p) splx(s); return error; } + sc->sc_rr.pause = 0; + sc->sc_pr.pause = 0; if ((sc->sc_mode & AUMODE_PLAY) && !sc->sc_pbus && pbus) error = audiostartp(sc); if (!error && |