Date: Tue, 17 Feb 2004 09:14:23 -0800 (PST) From: Don Lewis <truckman@FreeBSD.org> To: haro@h4.dion.ne.jp Cc: mat@cnd.mcgill.ca Subject: Re: LOR with sound Message-ID: <200402171714.i1HHEO7E050341@gw.catspoiler.org> In-Reply-To: <20040218.021017.74756279.haro@h4.dion.ne.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
On 18 Feb, Munehiro Matsuda wrote:
> Hello Don Lewis,
>
> Thank you for looking into the problem, but....
>
> ::Can you try the patch below? Be warned that I don't have the
> ::appropriate combination of hardware and software to really exercise it.
> ::I know that it won't fix the problem of
>
> I cannot seem to find the patch. ;-)
I forgot to attach it. Maybe I'll remember this time ...
Index: sys/dev/sound/pcm/dsp.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pcm/dsp.c,v
retrieving revision 1.72
diff -u -r1.72 dsp.c
--- sys/dev/sound/pcm/dsp.c 28 Jan 2004 08:02:15 -0000 1.72
+++ sys/dev/sound/pcm/dsp.c 17 Feb 2004 16:30:03 -0000
@@ -500,8 +500,14 @@
p->play_size = 0;
p->rec_size = 0;
if (wrch) {
+ if (rdch)
+ CHN_UNLOCK(rdch);
chn_setblocksize(wrch, 2, p->play_size);
p->play_size = sndbuf_getblksz(wrch->bufsoft);
+ CHN_UNLOCK(wrch);
+ wrch = NULL;
+ if (rdch)
+ CHN_LOCK(rdch);
}
if (rdch) {
chn_setblocksize(rdch, 2, p->rec_size);
@@ -525,8 +531,14 @@
snd_chan_param *p = (snd_chan_param *)arg;
if (wrch) {
+ if (rdch)
+ CHN_UNLOCK(rdch);
chn_setformat(wrch, p->play_format);
chn_setspeed(wrch, p->play_rate);
+ CHN_UNLOCK(wrch);
+ wrch = NULL;
+ if (rdch)
+ CHN_LOCK(rdch);
}
if (rdch) {
chn_setformat(rdch, p->rec_format);
@@ -633,8 +645,15 @@
case SNDCTL_DSP_SETBLKSIZE:
RANGE(*arg_i, 16, 65536);
- if (wrch)
+ if (wrch) {
+ if (rdch)
+ CHN_UNLOCK(rdch);
chn_setblocksize(wrch, 2, *arg_i);
+ CHN_UNLOCK(wrch);
+ wrch = NULL;
+ if (rdch)
+ CHN_LOCK(rdch);
+ }
if (rdch)
chn_setblocksize(rdch, 2, *arg_i);
break;
@@ -662,8 +681,14 @@
/* chn_setspeed may sleep */
tmp = 0;
if (wrch) {
+ if (rdch)
+ CHN_UNLOCK(rdch);
ret = chn_setspeed(wrch, *arg_i);
tmp = wrch->speed;
+ CHN_UNLOCK(wrch);
+ wrch = NULL;
+ if (rdch)
+ CHN_LOCK(rdch);
}
if (rdch && ret == 0) {
ret = chn_setspeed(rdch, *arg_i);
@@ -681,8 +706,14 @@
tmp = -1;
*arg_i = (*arg_i)? AFMT_STEREO : 0;
if (wrch) {
+ if (rdch)
+ CHN_UNLOCK(rdch);
ret = chn_setformat(wrch, (wrch->format & ~AFMT_STEREO) | *arg_i);
tmp = (wrch->format & AFMT_STEREO)? 1 : 0;
+ CHN_UNLOCK(wrch);
+ wrch = NULL;
+ if (rdch)
+ CHN_LOCK(rdch);
}
if (rdch && ret == 0) {
ret = chn_setformat(rdch, (rdch->format & ~AFMT_STEREO) | *arg_i);
@@ -698,8 +729,14 @@
tmp = 0;
*arg_i = (*arg_i != 1)? AFMT_STEREO : 0;
if (wrch) {
+ if (rdch)
+ CHN_UNLOCK(rdch);
ret = chn_setformat(wrch, (wrch->format & ~AFMT_STEREO) | *arg_i);
tmp = (wrch->format & AFMT_STEREO)? 2 : 1;
+ CHN_UNLOCK(wrch);
+ wrch = NULL;
+ if (rdch)
+ CHN_LOCK(rdch);
}
if (rdch && ret == 0) {
ret = chn_setformat(rdch, (rdch->format & ~AFMT_STEREO) | *arg_i);
@@ -724,8 +761,14 @@
if ((*arg_i != AFMT_QUERY)) {
tmp = 0;
if (wrch) {
+ if (rdch)
+ CHN_UNLOCK(rdch);
ret = chn_setformat(wrch, (*arg_i) | (wrch->format & AFMT_STEREO));
tmp = wrch->format & ~AFMT_STEREO;
+ CHN_UNLOCK(wrch);
+ wrch = NULL;
+ if (rdch)
+ CHN_LOCK(rdch);
}
if (rdch && ret == 0) {
ret = chn_setformat(rdch, (*arg_i) | (rdch->format & AFMT_STEREO));
@@ -757,9 +800,15 @@
DEB(printf("SNDCTL_DSP_SETFRAGMENT %d frags, %d sz\n", maxfrags, fragsz));
if (rdch) {
+ if (wrch)
+ CHN_UNLOCK(wrch);
ret = chn_setblocksize(rdch, maxfrags, fragsz);
maxfrags = sndbuf_getblkcnt(rdch->bufsoft);
fragsz = sndbuf_getblksz(rdch->bufsoft);
+ CHN_UNLOCK(rdch);
+ rdch = NULL;
+ if (wrch)
+ CHN_LOCK(wrch);
}
if (wrch && ret == 0) {
ret = chn_setblocksize(wrch, maxfrags, fragsz);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402171714.i1HHEO7E050341>
