aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorCameron Grant <cg@FreeBSD.org>2000-07-30 19:38:26 +0000
committerCameron Grant <cg@FreeBSD.org>2000-07-30 19:38:26 +0000
commit1c60ef3f3c332af0f4d123c281494bfe5fac6949 (patch)
tree54e180c73dc3b2f934f7b263e6ad9ea809783cfe /sys/dev
parente04387c95a202778e4826bdeb2837a4befabc9c6 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/sound/pcm/channel.c13
-rw-r--r--sys/dev/sound/pcm/datatypes.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index cb2c9e5a21f8..23d3232f11ea 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -547,8 +547,19 @@ static int
chn_rddump(pcm_channel *c, int cnt)
{
snd_dbuf *b = &c->buffer;
+ int maxover, ss;
- printf("overrun, dumping %d bytes\n", cnt);
+ ss = 1;
+ ss <<= (b->fmt & AFMT_STEREO)? 1 : 0;
+ ss <<= (b->fmt & AFMT_16BIT)? 1 : 0;
+ maxover = c->speed * ss;
+
+ b->overrun += cnt;
+ if (b->overrun > maxover) {
+ device_printf(c->parent->dev, "record overrun, dumping %d bytes\n",
+ b->overrun);
+ b->overrun = 0;
+ }
b->rl -= cnt;
b->fl += cnt;
b->rp = (b->rp + cnt) % b->bufsize;
diff --git a/sys/dev/sound/pcm/datatypes.h b/sys/dev/sound/pcm/datatypes.h
index 31df62be1d79..986829a0d858 100644
--- a/sys/dev/sound/pcm/datatypes.h
+++ b/sys/dev/sound/pcm/datatypes.h
@@ -67,7 +67,7 @@ struct _snd_dbuf {
volatile u_int32_t total, prev_total;
int chan, dir; /* dma channel */
int fmt, blksz, blkcnt;
- int underflow;
+ int underflow, overrun;
bus_dmamap_t dmamap;
struct selinfo sel;
};