[CM] Re: snd jack playback mode bug
Kjetil Svalastog Matheussen
k.s.matheussen@notam02.no
Sun, 7 Nov 2004 18:58:50 +0100 (CET)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
--8323328-1537600894-1099850330=:11258
Content-Type: TEXT/PLAIN; charset=US-ASCII
On Sun, 7 Nov 2004, Kjetil Svalastog Matheussen wrote:
>
> Oh yes, thank you. jack_get_ports returns NULL when there are no ports.
> I'll fix it ASAP.
>
> Something like this is a quick fix:
>
>
> static int sndjack_getnuminchannels(void){
> int lokke=0;
> const char **ports=jack_get_ports(sndjack_client,"alsa_pcm:capture_*","",0);
>
> if(ports==NULL) return 0;
>
> while(ports[lokke]!=NULL){ ////// ****appears to crash here with lokke=0
> lokke++;
> }
> if(lokke<2) return 2;
> return lokke;
> }
>
Oops. That was not enough. Below and attached is a working patch. Thanks
for your excellent bug-report Tim.
Please apply Bill.
--- audio.c~ 2004-11-07 12:47:56.000000000 +0100
+++ audio.c 2004-11-07 18:51:49.000000000 +0100
@@ -9023,7 +9023,7 @@
static int sndjack_getnumoutchannels(void){
int lokke=0;
const char **ports=jack_get_ports(sndjack_client,"alsa_pcm:playback_*","",0);
- while(ports[lokke]!=NULL){
+ while(ports!=NULL && ports[lokke]!=NULL){
lokke++;
}
if(lokke<2) return 2;
@@ -9033,7 +9033,7 @@
static int sndjack_getnuminchannels(void){
int lokke=0;
const char **ports=jack_get_ports(sndjack_client,"alsa_pcm:capture_*","",0);
- while(ports[lokke]!=NULL){
+ while(ports!=NULL && ports[lokke]!=NULL){
lokke++;
}
if(lokke<2) return 2;
@@ -9137,8 +9137,7 @@
)
)
{
- fprintf (stderr, "Error. Cannot connect jack output port %d: \"%s\".\n",ch,temp);
- goto failed_connect;
+ printf ("Warning. Cannot connect jack output port %d: \"%s\".\n",ch,temp);
}
}
@@ -9153,8 +9152,7 @@
)
)
{
- fprintf (stderr, "Error. Cannot connect jack input port %d: \"%s\".\n",ch,temp);
- goto failed_connect;
+ printf ("Warning. Cannot connect jack input port %d: \"%s\".\n",ch,temp);
}
}
--
--8323328-1537600894-1099850330=:11258
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="audio.c.diff"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.58.0411071858500.11258@hensten.localdomain>
Content-Description:
Content-Disposition: attachment; filename="audio.c.diff"
LS0tIGF1ZGlvLmN+CTIwMDQtMTEtMDcgMTI6NDc6NTYuMDAwMDAwMDAwICsw
MTAwDQorKysgYXVkaW8uYwkyMDA0LTExLTA3IDE4OjU1OjU2LjAwMDAwMDAw
MCArMDEwMA0KQEAgLTkwMjMsNyArOTAyMyw3IEBADQogc3RhdGljIGludCBz
bmRqYWNrX2dldG51bW91dGNoYW5uZWxzKHZvaWQpew0KICAgaW50IGxva2tl
PTA7DQogICBjb25zdCBjaGFyICoqcG9ydHM9amFja19nZXRfcG9ydHMoc25k
amFja19jbGllbnQsImFsc2FfcGNtOnBsYXliYWNrXyoiLCIiLDApOw0KLSAg
d2hpbGUocG9ydHNbbG9ra2VdIT1OVUxMKXsNCisgIHdoaWxlKHBvcnRzIT1O
VUxMICYmIHBvcnRzW2xva2tlXSE9TlVMTCl7DQogICAgIGxva2tlKys7DQog
ICB9DQogICBpZihsb2trZTwyKSByZXR1cm4gMjsNCkBAIC05MDMzLDcgKzkw
MzMsNyBAQA0KIHN0YXRpYyBpbnQgc25kamFja19nZXRudW1pbmNoYW5uZWxz
KHZvaWQpew0KICAgaW50IGxva2tlPTA7DQogICBjb25zdCBjaGFyICoqcG9y
dHM9amFja19nZXRfcG9ydHMoc25kamFja19jbGllbnQsImFsc2FfcGNtOmNh
cHR1cmVfKiIsIiIsMCk7DQotICB3aGlsZShwb3J0c1tsb2trZV0hPU5VTEwp
ew0KKyAgd2hpbGUocG9ydHMhPU5VTEwgJiYgcG9ydHNbbG9ra2VdIT1OVUxM
KXsNCiAgICAgbG9ra2UrKzsNCiAgI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