Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/dev Pull up revision 1.157 (requested by gson in ti...



details:   https://anonhg.NetBSD.org/src/rev/9511eb624f7f
branches:  netbsd-1-6
changeset: 529313:9511eb624f7f
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Nov 10 07:42:08 2002 +0000

description:
Pull up revision 1.157 (requested by gson in ticket #972):
The logic in audio_poll() was incorrect in full duplex mode;
among other things, it behaved as if full-duplex audio devices
were always ready for writing.  Also commented the code in case.
This fixes PRs kern/11179 and kern/13829.

diffstat:

 sys/dev/audio.c |  19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r 3de2293cdbfb -r 9511eb624f7f sys/dev/audio.c
--- a/sys/dev/audio.c   Sat Nov 09 10:23:52 2002 +0000
+++ b/sys/dev/audio.c   Sun Nov 10 07:42:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.155.4.2 2002/08/27 09:46:17 lukem Exp $    */
+/*     $NetBSD: audio.c,v 1.155.4.3 2002/11/10 07:42:08 tron Exp $     */
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.155.4.2 2002/08/27 09:46:17 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.155.4.3 2002/11/10 07:42:08 tron Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -1896,13 +1896,24 @@
        DPRINTF(("audio_poll: events=0x%x mode=%d\n", events, sc->sc_mode));
 
        if (events & (POLLIN | POLLRDNORM))
-               if ((sc->sc_mode & AUMODE_PLAY) ?
+               /*
+                * If half duplex and playing, audio_read() will generate
+                * silence at the play rate; poll for silence being
+                * available.  Otherwise, poll for recorded sound.
+                */
+               if ((!sc->sc_full_duplex && (sc->sc_mode & AUMODE_PLAY)) ?
                    sc->sc_pr.stamp > sc->sc_wstamp :
                    sc->sc_rr.used > sc->sc_rr.usedlow)
                        revents |= events & (POLLIN | POLLRDNORM);
 
        if (events & (POLLOUT | POLLWRNORM))
-               if (sc->sc_mode & AUMODE_RECORD ||
+               /*
+                * If half duplex and recording, audio_write() will throw
+                * away play data, which means we are always ready to write.
+                * Otherwise, poll for play buffer being below its low water
+                * mark.
+                */
+               if ((!sc->sc_full_duplex && (sc->sc_mode & AUMODE_RECORD)) ||
                    sc->sc_pr.used <= sc->sc_pr.usedlow)
                        revents |= events & (POLLOUT | POLLWRNORM);
 



Home | Main Index | Thread Index | Old Index