From nobody@FreeBSD.org  Fri Nov 26 17:43:13 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5166316A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 26 Nov 2004 17:43:13 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3181F43D54
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 26 Nov 2004 17:43:13 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iAQHhCqe081023
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 26 Nov 2004 17:43:12 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iAQHhCgG081022;
	Fri, 26 Nov 2004 17:43:12 GMT
	(envelope-from nobody)
Message-Id: <200411261743.iAQHhCgG081022@www.freebsd.org>
Date: Fri, 26 Nov 2004 17:43:12 GMT
From: Federico Besnard <fico@del.ufrj.br>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ohphone 1.4.1 crashes in 5.3 Stable
X-Send-Pr-Version: www-2.3

>Number:         74432
>Category:       kern
>Synopsis:       Yamaha DS-1E produces "kernel: Danger! pcm0:play:2 bufsoft size increasing from 3584 to 3956 after CHANNEL_SETBLOCKSIZE()"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 26 17:50:39 GMT 2004
>Closed-Date:    Fri Jun 15 11:34:59 GMT 2007
>Last-Modified:  Fri Jul  6 03:00:09 GMT 2007
>Originator:     Federico Besnard
>Release:        5.3-Stable
>Organization:
DEL/UFRJ
>Environment:
% uname -a
FreeBSD [...] 5.3-STABLE FreeBSD 5.3-STABLE #2: Thu Nov 25 14:33:31 GMT-1 2004     [...]  i386

>Description:
Executing ohphone -l will produces PCM error message. No sound is available. Configuration file looks OK, ohphone signs up with gatekeeper.

Sound works well otherwise. KDE 3.3.0 aRts on /dev/dsp generates clean output and poor input (mic seems to be noise). No error messages.

I am running on a Toshiba Satellite 2805-s302,
% dmesg | grep pcm
pcm0: <Yamaha DS-1E (YMF754)> port 0xfebc-0xfebf,0xfec0-0xfeff mem 0xefdf0000-0xefdf7fff irq 11 at device 12.0 on pci0
pcm0: <Asahi Kasei AK4543 AC97 Codec>
pcm0: [GIANT-LOCKED]

Kernel is fresh new up to date, idem ports.

Error Message:
Nov 26 18:28:52 camelot kernel: Danger! pcm0:play:2 bufsoft size increasing from 3584 to 3956 after CHANNEL_SETBLOCKSIZE()
Nov 26 18:28:52 camelot kernel: Danger! pcm0:record:1 bufsoft size increasing from 3584 to 4048 after CHANNEL_SETBLOCKSIZE()
Nov 26 18:28:52 camelot kernel: Danger! pcm0:play:2 bufsoft size increasing from 3584 to 3956 after CHANNEL_SETBLOCKSIZE()
Nov 26 18:28:52 camelot kernel: Danger! pcm0:record:1 bufsoft size increasing from 3584 to 4048 after CHANNEL_SETBLOCKSIZE()
Nov 26 18:28:52 camelot kernel: Danger! pcm0:play:2 bufsoft size increasing from 3584 to 3956 after CHANNEL_SETBLOCKSIZE()
Nov 26 18:28:52 camelot kernel: Danger! pcm0:record:1 bufsoft size increasing from 3584 to 4048 after CHANNEL_SETBLOCKSIZE()
Nov 26 18:28:53 camelot kernel: pcm0:play:2: play interrupt timeout, channel dead
                                          
>How-To-Repeat:
(you need a well set ~/.pwlib/ohphone.ini)

% ohphone -l
OhPhone Version 1.4.1 by Open H323 Project on Unix FreeBSD (5.3-STABLE-i386)

Incoming channel port ranges 5000 to 5999
Local username: *****
TerminateOnHangup is 0
Auto answer is 0
DialAfterHangup is 0
FastStart is 1
H245Tunnelling is 1
SilenceSupression is 1
H245InSetup is 1
Jitter buffer: 50-250 ms
Connect port: 1720

Video receive disabled

Video transmit disabled


Sound output device: "/dev/dsp"
Sound  input device: "/dev/dsp"
Recording using mixer channel mic
Record volume is 75
Play volume is 75
G.711 frame size: 30
GSM frame size: 4
User Input Send Mode: as H.245 string
Codecs (in preference order):
 Table:
   GSM-06.10{sw} <1>
   MS-GSM{sw} <2>
   G.711-uLaw-64k{sw} <3>
   G.711-ALaw-64k{sw} <4>
   SpeexNarrow-8k{sw} <5>
   SpeexNarrow-11k{sw} <6>
   SpeexNarrow-15k{sw} <7>
   SpeexNarrow-18.2k{sw} <8>
   SpeexNarrow-5.95k{sw} <9>
   G.726-16k{sw} <10>
   G.726-24k{sw} <11>
   G.726-32k{sw} <12>
   G.726-40k{sw} <13>
   LPC-10{sw} <14>
   UserInput/hookflash <15>
   UserInput/basicString <16>
   UserInput/dtmf <17>
   UserInput/RFC2833 <18>
 Set:
   0:
     0:
       GSM-06.10{sw} <1>
       MS-GSM{sw} <2>
       G.711-uLaw-64k{sw} <3>
       G.711-ALaw-64k{sw} <4>
       SpeexNarrow-8k{sw} <5>
       SpeexNarrow-11k{sw} <6>
       SpeexNarrow-15k{sw} <7>
       SpeexNarrow-18.2k{sw} <8>
       SpeexNarrow-5.95k{sw} <9>
       G.726-16k{sw} <10>
       G.726-24k{sw} <11>
       G.726-32k{sw} <12>
       G.726-40k{sw} <13>
       LPC-10{sw} <14>
     1:
       UserInput/hookflash <15>
     2:
       UserInput/basicString <16>
       UserInput/dtmf <17>
       UserInput/RFC2833 <18>


Listening interfaces : ALL:1720
Enabling H.235 security access to gatekeeper.
Gatekeeper set: ***@***.***
Waiting for incoming calls for "*****"
Command ? c1555666777
FicoGDB is calling host 1555666777
Command ? Started logical channel: sending G.711-uLaw-64k{sw} <3>
Started logical channel: receiving G.711-uLaw-64k{sw} <3>
Ringing phone for "*.*.*.*" ...
Call with "*.*.*.*" established.
      
>Fix:
unknown
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->roger  
Responsible-Changed-By: krion 
Responsible-Changed-When: Sun Nov 28 10:28:49 GMT 2004 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74432 
Responsible-Changed-From-To: roger->freebsd-ports-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Dec 5 05:05:43 GMT 2004 
Responsible-Changed-Why:  
Reassign to pool; maintainer is away from FreeBSD work at the moment. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74432 
Responsible-Changed-From-To: freebsd-ports-bugs->lawrance 
Responsible-Changed-By: lawrance 
Responsible-Changed-When: Tue May 24 13:40:50 GMT 2005 
Responsible-Changed-Why:  
Grab 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74432 
State-Changed-From-To: open->feedback 
State-Changed-By: lawrance 
State-Changed-When: Wed Sep 7 13:43:18 GMT 2005 
State-Changed-Why:  
Do you still have this problem with an up to date version of FreeBSD? 
Seems like the problem lies outside of ohphone, which is just a 
trigger. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74432 
State-Changed-From-To: feedback->analyzed 
State-Changed-By: lawrance 
State-Changed-When: Sat Oct 1 04:19:46 GMT 2005 
State-Changed-Why:  
Feedback received. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74432 

From: Sam Lawrance <lawrance@FreeBSD.org>
To: Federico Galvez-Durand Besnard <fico@del.ufrj.br>,
        bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/74432: ohphone 1.4.1 crashes in 5.3 Stable
Date: Sat, 1 Oct 2005 14:16:55 +1000

 I asked Don Lewis to have a look, since he added the code that produces
 the warning you are seeing.  This appears to be a kernel issue
 (provoked, but not caused by ohphone).
 
 From: Don Lewis <truckman@FreeBSD.org>
 To: lawrance@FreeBSD.org
 Subject: Re: ports/74432
 Date: Wed, 07 Sep 2005 09:50:34 -0700 (PDT)
 
 On  8 Sep, Sam Lawrance wrote:
 > Wondering if I can ask your opinion.  I notice you added this to
 > src/sys/dev/sound/pcm/channel.c:
 > 
 >         /* Decrease the size of bufsoft after decreasing bufhard. */
 >         maxsize = sndbuf_getsize(b);
 >         if (reqblksz * blkcnt > maxsize)
 >                 maxsize = reqblksz * blkcnt;
 >         if (maxsize > sndbuf_getsize(bs))
 >                 printf("Danger! %s bufsoft size increasing from %d to
 > %d after CHANNEL_SETBLOCKSIZE()\n", c->name, sndbuf_getsize(bs),
 > maxsize); if (sndbuf_getsize(bs) != maxsize || sndbuf_getblksz(bs) !=
 > reqblksz) { ret = sndbuf_remalloc(bs, maxsize/reqblksz, reqblksz);
 >                 if (ret)
 >                         goto out1;
 >         }
 > 
 > This guy can reproduce that warning:
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/74432
 
 It looks to me like the problem is that the Yamaha hardware only
 supports a fixed block size at any given sample rate, and that the
 application is requesting a larger block size.  I suspect that the
 correct fix is to replace all references to reqblksz in the code you
 cited above with sndbuf_getblksz(bs).  The code before the
 CHANNEL_SETBLOCKSIZE() call should not be modified.
 
 This change should be extensively tested on other hardware and with
 other applications before being committed.
 

From: Sam Lawrance <lawrance@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/74432: ohphone 1.4.1 crashes in 5.3 Stable
Date: Sat, 1 Oct 2005 14:34:22 +1000

 Feedback from submitter follows ...
 
 Begin forwarded message:
 
 Date: Wed, 21 Sep 2005 17:54:41 +0200
 From: Federico Galvez-Durand Besnard <fico@del.ufrj.br>
 To: Sam Lawrance <lawrance@FreeBSD.org>
 Subject: Re: ports/74432: ohphone 1.4.1 crashes in 5.3 Stable
 
 
 uname -a: FreeBSD 5.4-STABLE #0: Fri Aug 26 09:00:09 GMT-2 2005 i386
 
 Yes, the problem persists.  These are the latest versions I have
 already hacked:
 
 openh323_1.12.2.tar.gz
 openh323-v1_17_2-src-tar.gz
 openh323-v1_17_1-src-tar.gz 
 pwlib-v1_9_0-src-tar.gz
 pwlib-v1_9_1-src-tar.gz
 ohphone-v1_14_4-src-tar.gz     
 ohphone-v1_7_3-src-tar.gz      
 
 Lately, I have seen and tried this patch:
 ftp://ftp.frm2.tum.de/pub/jpulz/FreeBSD/pwlib_openh323-20050719.patch
 
 I guess it brought me to the same place I have been before with my own 
 hacking.
 
 Weird enough, gnomemeeting manages to test /dev/dsp recording and 
 reproducing what I say. And this port uses the same pwlib and openh323 
 ports than OhPhone.
 I could not test it for a talk session yet due to problems of 
 compatibility with my GateKeeper (it seems to work well only with
 OhPhone).
 
 Skype port works 100%. Never crashed on me. I have had rather long 
 talks... of course, it does not use pwlib+openh323... but it does use 
 /dev/dsp (as far as I know).
 
 It seems that OhPhone cannot open /dev/dsp in full duplex mode 
 (permission is 0666) . It fails with either a message (twice):
 ++
 Could not open sound device /dev/dsp0.0 - Check permissions or full 
 duplex capability.
 Could not open sound device /dev/dsp0.0 - Check permissions or full 
 duplex capability.
 ++ 
 
 Or with the messages you have seen in my previous email coming out from 
 DSP (Panic and so on...).
 
 So, I think there must be something in the way OhPhone is using pwlib + 
 openh323 that is causing this problem... but I cannot find it. The fact 
 of dislaking C++ does not help either. ;)
 
 If I switch my boot to winXP, OhPhone works well. Same hardware.
 
 Maybe I should post updates on what I was doing. Sincerely, I got the 
 impression I was the only one interested in OhPhone... so I kept quiet 
 to improve signal to noise ratio on the lists. Sorry about that.
 
 Thank you very much for asking.
 
Responsible-Changed-From-To: lawrance->freebsd-bugs 
Responsible-Changed-By: lawrance 
Responsible-Changed-When: Sat Oct 1 04:46:09 GMT 2005 
Responsible-Changed-Why:  
Kernel issue 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74432 
State-Changed-From-To: analyzed->feedback 
State-Changed-By: gavin 
State-Changed-When: Mon Jun 11 18:36:46 UTC 2007 
State-Changed-Why:  

To submitter: Do you still see this problem on more recent versions 
of FreeBSD? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74432 
State-Changed-From-To: feedback->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Jun 15 11:34:14 UTC 2007 
State-Changed-Why:  
Feedback timeout. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74432 

From: linimon@lonesome.com (Mark Linimon)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/74432: Yamaha DS-1E produces "kernel: Danger! pcm0:play:2 bufsoft size increasing from 3584 to 3956 after CHANNEL_SETBLOCKSIZE()"
Date: Thu, 5 Jul 2007 21:58:44 -0500

 ----- Forwarded message from Federico Galvez-Durand Besnard <fico@del.ufrj.br> -----
 
 
 Regarding this issue, Sam Lawrance <lawrance@FreeBSD.org> wrote to me in 
 Oct 2005.
 Unfortunately, I haven't tested Don Lewis' patch yet.
 When Sam's message arrived, I had already moved on to another solution 
 for my problem using OhPhone.
 Everything else worked just fine with PCM in that machine, including Skype.
 I just looked into the pcm/channel.c code in 6.2-p1, the code mentioned 
 in the patch seems to be the same yet. I suppose the problem with this 
 Yamaha DS-1E is still there.
 If I get OhPhone to work again on that machine and reproduce the same 
 error, I may try this patch. It is the only application provoking this 
 problem.
 
 I hope this helps.
 Fico
 
 P.S.: This is the source message I received from Sam Lawrance:
 
 From - Sat Oct  1 09:08:41 2005
 X-Account-Key: account3
 X-UIDL: AKi!!``P"!T$>"!6IH"!
 X-Mozilla-Status: 0011
 X-Mozilla-Status2: 00000000
 Return-Path: <lawrance@FreeBSD.org>
 Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84])
 	by zeus.del.ufrj.br (8.12.9p1/8.12.9) with ESMTP id j914GP7B028171
 	for <fico@del.ufrj.br>; Sat, 1 Oct 2005 01:16:28 -0300 (BRT)
 Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au 
 [61.8.0.86])
 	by mailout1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id 
 	j914GHP7023609;
 	Sat, 1 Oct 2005 14:16:17 +1000
 Received: from dirk.no.domain (ppp287C.dyn.pacific.net.au [61.8.40.124])
 	by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id 
 	j914GF8w020745;
 	Sat, 1 Oct 2005 14:16:16 +1000
 Date: Sat, 1 Oct 2005 14:16:55 +1000
 From: Sam Lawrance <lawrance@FreeBSD.org>
 To: Federico Galvez-Durand Besnard <fico@del.ufrj.br>,
   bug-followup@FreeBSD.org
 Subject: Re: ports/74432: ohphone 1.4.1 crashes in 5.3 Stable
 Message-ID: <20051001141655.39235a4d@dirk.no.domain>
 In-Reply-To: <43318241.8080803@del.ufrj.br>
 References: <200509071346.j87DkdVm091458@freefall.freebsd.org>
 	<43318241.8080803@del.ufrj.br>
 X-Mailer: Sylpheed-Claws 1.9.14 (GTK+ 2.6.10; i386-portbld-freebsd6.0)
 Mime-Version: 1.0
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 X-UIDL: AKi!!``P"!T$>"!6IH"!
 
 I asked Don Lewis to have a look, since he added the code that produces
 the warning you are seeing.  This appears to be a kernel issue
 (provoked, but not caused by ohphone).
 
 From: Don Lewis <truckman@FreeBSD.org>
 To: lawrance@FreeBSD.org
 Subject: Re: ports/74432
 Date: Wed, 07 Sep 2005 09:50:34 -0700 (PDT)
 
 On  8 Sep, Sam Lawrance wrote:
 >Wondering if I can ask your opinion.  I notice you added this to
 >src/sys/dev/sound/pcm/channel.c:
 >
 >        /* Decrease the size of bufsoft after decreasing bufhard. */
 >        maxsize = sndbuf_getsize(b);
 >        if (reqblksz * blkcnt > maxsize)
 >                maxsize = reqblksz * blkcnt;
 >        if (maxsize > sndbuf_getsize(bs))
 >                printf("Danger! %s bufsoft size increasing from %d to
 >%d after CHANNEL_SETBLOCKSIZE()\n", c->name, sndbuf_getsize(bs),
 >maxsize); if (sndbuf_getsize(bs) != maxsize || sndbuf_getblksz(bs) !=
 >reqblksz) { ret = sndbuf_remalloc(bs, maxsize/reqblksz, reqblksz);
 >                if (ret)
 >                        goto out1;
 >        }
 >
 >This guy can reproduce that warning:
 >http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/74432
 
 It looks to me like the problem is that the Yamaha hardware only
 supports a fixed block size at any given sample rate, and that the
 application is requesting a larger block size.  I suspect that the
 correct fix is to replace all references to reqblksz in the code you
 cited above with sndbuf_getblksz(bs).  The code before the
 CHANNEL_SETBLOCKSIZE() call should not be modified.
 
 This change should be extensively tested on other hardware and with
 other applications before being committed.
 
 ----- End forwarded message -----
>Unformatted:
