summaryrefslogtreecommitdiffstats
path: root/sys/dev/audio.c
diff options
context:
space:
mode:
authorjakemsr <jakemsr@openbsd.org>2007-07-06 04:10:34 +0000
committerjakemsr <jakemsr@openbsd.org>2007-07-06 04:10:34 +0000
commit77de3c4432763d1c1e08f34b2722fe60bb281dc4 (patch)
tree6c7985cb9039ee03b07239bb52d7f716f5e482ce /sys/dev/audio.c
parentnet80211 growth eats another ethernet driver (which is super rare on laptops) (diff)
downloadwireguard-openbsd-77de3c4432763d1c1e08f34b2722fe60bb281dc4.tar.xz
wireguard-openbsd-77de3c4432763d1c1e08f34b2722fe60bb281dc4.zip
- 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@
Diffstat (limited to 'sys/dev/audio.c')
-rw-r--r--sys/dev/audio.c7
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 &&