sound/pcm: fix calculation of PCM channel timeout soundfix
authorMatthias Rampke <matthias@rampke.de>
Sat, 7 May 2011 22:18:41 +0000 (00:18 +0200)
committerMatthias Rampke <matthias@rampke.de>
Sat, 7 May 2011 22:18:41 +0000 (00:18 +0200)
this fixes a "pcm0:virtual:0:dsp0.2: play interrupt timeout, channel dead" error
and sound dying after a few seconds of playback.
I encountered on my Thinkpad X40. It was discussed on freebsd-current in 2004[1] but that code is no longer present in FBSD while we still have it.

The patch removes a line fixing a channel timeout to 1 tick instead of the value calculated immediately beforehand, thus restoring the calculation.

[1] http://lists.freebsd.org/pipermail/freebsd-current/2004-September/036805.html

sys/dev/sound/pcm/channel.c

index 45f5d8f..cecf972 100644 (file)
@@ -340,7 +340,7 @@ chn_write(struct pcm_channel *c, struct uio *buf, int ioflags)
                                timeout = (hz * sndbuf_getblksz(bs)) / (sndbuf_getspd(bs) * sndbuf_getbps(bs));
                                if (timeout < 1)
                                        timeout = 1;
                                timeout = (hz * sndbuf_getblksz(bs)) / (sndbuf_getspd(bs) * sndbuf_getbps(bs));
                                if (timeout < 1)
                                        timeout = 1;
-                               timeout = 1;
+                               /* timeout = 1; */
                                ret = chn_sleep(c, "pcmwr", timeout);
                                if (ret == EWOULDBLOCK) {
                                        count -= timeout;
                                ret = chn_sleep(c, "pcmwr", timeout);
                                if (ret == EWOULDBLOCK) {
                                        count -= timeout;