diff options
author | 2010-09-17 08:08:23 +0000 | |
---|---|---|
committer | 2010-09-17 08:08:23 +0000 | |
commit | a7ef0dde0fa7ca422c73f3ce3ba8d574307b042e (patch) | |
tree | b251389c5464cd517e98c87241138cab566a2688 | |
parent | use audio(4) DVACT_{QUIESCE,RESUME} (diff) | |
download | wireguard-openbsd-a7ef0dde0fa7ca422c73f3ce3ba8d574307b042e.tar.xz wireguard-openbsd-a7ef0dde0fa7ca422c73f3ce3ba8d574307b042e.zip |
don't try to get the current stream postion when the device is stopped,
and don't generate clock ticks (ie don't invoke the sio_onmove(3)
call-back).
-rw-r--r-- | lib/libsndio/sun.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/libsndio/sun.c b/lib/libsndio/sun.c index 946e493a4cc..b1f17f691eb 100644 --- a/lib/libsndio/sun.c +++ b/lib/libsndio/sun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sun.c,v 1.40 2010/08/06 06:52:17 ratchov Exp $ */ +/* $OpenBSD: sun.c,v 1.41 2010/09/17 08:08:23 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -894,6 +894,8 @@ sun_revents(struct sio_hdl *sh, struct pollfd *pfd) int xrun, dmove, dierr = 0, doerr = 0, delta; int revents = pfd->revents; + if (!hdl->sio.started) + return pfd->revents; if (hdl->sio.mode & SIO_PLAY) { if (ioctl(hdl->fd, AUDIO_PERROR, &xrun) < 0) { DPERROR("sun_revents: PERROR"); @@ -957,13 +959,11 @@ sun_revents(struct sio_hdl *sh, struct pollfd *pfd) * right now to adjust revents, and avoid busy loops * programs */ - if (hdl->sio.started) { - if (hdl->filling) - revents |= POLLOUT; - if ((hdl->sio.mode & SIO_PLAY) && !sun_wsil(hdl)) - revents &= ~POLLOUT; - if ((hdl->sio.mode & SIO_REC) && !sun_rdrop(hdl)) - revents &= ~POLLIN; - } + if (hdl->filling) + revents |= POLLOUT; + if ((hdl->sio.mode & SIO_PLAY) && !sun_wsil(hdl)) + revents &= ~POLLOUT; + if ((hdl->sio.mode & SIO_REC) && !sun_rdrop(hdl)) + revents &= ~POLLIN; return revents; } |