Subject: kern/19614: audio device uses play ringbuffer information for record ringbuffer watermarks
To: None <gnats-bugs@gnats.netbsd.org>
From: None <roskens@elfin.net>
List: netbsd-bugs
Date: 12/30/2002 15:31:38
>Number:         19614
>Category:       kern
>Synopsis:       audio device uses play ringbuffer information for record ringbuffer watermarks
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 30 15:32:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ron Roskens
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
The audio device driver has a typo in the audio_calcwater() function. When defining the record high watermark, it should be against sc_rr not sc_pr.

If you have an audio device which returns different values for the buffersizes, you'll hit this problem if the record buffer is larger than the play buffer.
>How-To-Repeat:

>Fix:
diff -w -u -r1.170 audio.c
--- /usr/src/sys/dev/audio.c    2002/12/20 18:30:01     1.170
+++ /usr/src/sys/dev/audio.c    2002/12/30 23:27:32
@@ -872,7 +872,7 @@
        if (sc->sc_pr.usedlow == sc->sc_pr.usedhigh)
                sc->sc_pr.usedlow -= sc->sc_pr.blksize;
        sc->sc_rr.usedhigh =
-               sc->sc_pr.end - sc->sc_pr.start - sc->sc_pr.blksize;
+               sc->sc_rr.end - sc->sc_rr.start - sc->sc_rr.blksize;
        sc->sc_rr.usedlow = 0;
 }
 

>Release-Note:
>Audit-Trail:
>Unformatted: