summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakemsr <jakemsr@openbsd.org>2009-06-18 22:55:56 +0000
committerjakemsr <jakemsr@openbsd.org>2009-06-18 22:55:56 +0000
commit7efd341e2e7d5adba1534aa46b0bfbe04390c981 (patch)
treeba2fa319129fb59ea915f34a3976957de8d8bc11
parentcomplete sync to 1.7.17: garbage collect unused functions (diff)
downloadwireguard-openbsd-7efd341e2e7d5adba1534aa46b0bfbe04390c981.tar.xz
wireguard-openbsd-7efd341e2e7d5adba1534aa46b0bfbe04390c981.zip
fix previous: start playback when at least one block of data has
been written to the device, instead of waiting for a write(2) when the buffer is or will be over the high water mark. ok ratchov@
-rw-r--r--sys/dev/audio.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 0ffdad02623..7bfd842382a 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.103 2009/03/21 13:16:21 ratchov Exp $ */
+/* $OpenBSD: audio.c,v 1.104 2009/06/18 22:55:56 jakemsr Exp $ */
/* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */
/*
@@ -1504,13 +1504,6 @@ audio_write(dev_t dev, struct uio *uio, int ioflag)
while (cb->used >= cb->usedhigh) {
DPRINTFN(2, ("audio_write: sleep used=%d lowat=%d hiwat=%d\n",
cb->used, cb->usedlow, cb->usedhigh));
- if (!sc->sc_pbus && !cb->pause) {
- error = audiostartp(sc);
- if (error) {
- splx(s);
- return error;
- }
- }
if (ioflag & IO_NDELAY) {
splx(s);
return (EWOULDBLOCK);
@@ -1540,6 +1533,13 @@ audio_write(dev_t dev, struct uio *uio, int ioflag)
* silence in the buffer, but it is simple.
*/
sc->sc_sil_count = 0;
+ if (!sc->sc_pbus && !cb->pause && cb->used >= cb->blksize) {
+ error = audiostartp(sc);
+ if (error) {
+ splx(s);
+ return error;
+ }
+ }
splx(s);
cc /= sc->sc_pparams.factor;
DPRINTFN(1, ("audio_write: uiomove cc=%d inp=%p, left=%d\n",