summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-09-17 08:08:24 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-09-17 08:08:24 +0000
commit3d1a2c418dc20ab910f7427fcb3b1f10dfe153a4 (patch)
tree841d8d07513918f2c58ca9589ba1cb4f79b610fe /lib
parentf1d0d8c28eb63eb535135015e3ef03ccc0d6b676 (diff)
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).
Diffstat (limited to 'lib')
-rw-r--r--lib/libsndio/sun.c18
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;
}