[CM] Re: snd jack playback mode bug

Kjetil Svalastog Matheussen k.s.matheussen@notam02.no
Sun, 7 Nov 2004 14:53:39 +0100 (CET)


Tim Orford:
>> > If you are running jack in Playback mode, snd 7.8 will
>> > imediately segfault in mus_audio_read_buffers().
>> >
>> > i assume that this is easily repeatable. I can provide
>> > any additional information if needed.
>> >
>>
>> Yes, please provide some code that use mus_audio_read_buffers.
>> I wrote the jack-code, but have never used mus_audio_read_buffers.
>
>yes thanks for adding this v useful functionality!
>I must apologise for the incorrect information regarding
>mus_audio_read_buffers - that was indicated by gdb but appears to
>be false. By adding printfs i beleive the segfault happens here:
>
>
>static int sndjack_getnuminchannels(void){
>  int lokke=0;
>  const char **ports=jack_get_ports(sndjack_client,"alsa_pcm:capture_*","",0);
>
>  while(ports[lokke]!=NULL){ ////// ****appears to crash here with lokke=0
>    lokke++;
>  }
>  if(lokke<2) return 2;
>  return lokke;
>}


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;
}


--