diff options
author | cg <cg@FreeBSD.org> | 2000-08-09 00:42:00 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2000-08-09 00:42:00 +0000 |
commit | 5d9a1c9f9cc4e7a501c4519e7695756232aad346 (patch) | |
tree | 9956ca53c4db277a229ccc457ab42d2353f85fba /sys/dev/sound/pcm/channel.c | |
parent | 6dac8645b86bb808d51201173eace0175022b968 (diff) | |
download | FreeBSD-src-5d9a1c9f9cc4e7a501c4519e7695756232aad346.zip FreeBSD-src-5d9a1c9f9cc4e7a501c4519e7695756232aad346.tar.gz |
warn if hwptr goes backwards
Diffstat (limited to 'sys/dev/sound/pcm/channel.c')
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 23d3232..cd40903 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -186,6 +186,11 @@ chn_dmaupdate(pcm_channel *c) DEB (int b_rl=b->rl; int b_fl=b->fl; int b_rp=b->rp; int b_fp=b->fp); hwptr = chn_getptr(c); + delta = (b->bufsize + hwptr - b->hp) % b->bufsize; + if (delta >= ((b->bufsize * 3) / 4)) { + if (!(c->flags & (CHN_F_CLOSING | CHN_F_ABORTING))) + device_printf(c->parent->dev, "hwptr went backwards %d -> %d\n", b->hp, hwptr); + } if (c->direction == PCMDIR_PLAY) { delta = (b->bufsize + hwptr - b->rp) % b->bufsize; b->rp = hwptr; @@ -204,6 +209,7 @@ chn_dmaupdate(pcm_channel *c) DEB(printf("OUCH!(%d) fl %d(%d) delta %d bufsize %d hwptr %d fp %d(%d)\n", chn_updatecount++, b->fl, b_fl, delta, b->bufsize, hwptr, b->fp, b_fp)); } } + b->hp = hwptr; b->total += delta; } @@ -234,7 +240,7 @@ chn_checkunderflow(pcm_channel *c) b->fl = b->bufsize - b->rl; b->underflow = 0; } else { - /* chn_dmaupdate(c); */ + chn_dmaupdate(c); } } |