From 68d15cd6e6b5f9f7e32d3dd9ba4361d58c4578b9 Mon Sep 17 00:00:00 2001 From: ariff Date: Fri, 11 Apr 2008 15:26:25 +0000 Subject: [PATCH] Don't mess up with CHN_F_TRIGGERED, since it should exclusively be handled by chn_abort() and chn_start() alone. This should fix few issues with single duplex hardware (mostly) or pre virtual record (RELENG 6) under WINE emulation and possibly others that using SNDCTL_DSP_SETTRIGGER. MFC after: 3 days --- sys/dev/sound/pcm/dsp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index e60c0a9f72ed..232a9502d401 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -1393,20 +1393,26 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread * case SNDCTL_DSP_SETTRIGGER: if (rdch) { CHN_LOCK(rdch); - rdch->flags &= ~(CHN_F_TRIGGERED | CHN_F_NOTRIGGER); + rdch->flags &= ~CHN_F_NOTRIGGER; if (*arg_i & PCM_ENABLE_INPUT) chn_start(rdch, 1); - else + else { + chn_abort(rdch); + chn_resetbuf(rdch); rdch->flags |= CHN_F_NOTRIGGER; + } CHN_UNLOCK(rdch); } if (wrch) { CHN_LOCK(wrch); - wrch->flags &= ~(CHN_F_TRIGGERED | CHN_F_NOTRIGGER); + wrch->flags &= ~CHN_F_NOTRIGGER; if (*arg_i & PCM_ENABLE_OUTPUT) chn_start(wrch, 1); - else + else { + chn_abort(wrch); + chn_resetbuf(wrch); wrch->flags |= CHN_F_NOTRIGGER; + } CHN_UNLOCK(wrch); } break;