Re: [Jack-Devel] jack_connect with many channels

PrevNext  Index
DateMon, 20 Oct 2014 01:20:37 +0200
From Robin Gareus <[hidden] at gareus dot org>
To[hidden] at trellis dot ch
Cc[hidden] at lists dot jackaudio dot org
In-Reply-To[hidden] at trellis dot ch [Jack-Devel] jack_connect with many channels
Follow-Up[hidden] at trellis dot ch Re: [Jack-Devel] jack_connect with many channels
> On Oct 19, 2014, at 8:17 PM, [hidden] wrote:
> 
> 
> Hi
> 
> i use the following code snippet to connect all available hardware/system
> capture ports to a client:
> 
> --
> 
>  if(autoconnect==1)
>  {
>    int j=0;
>    int i=0;
>    for(i=0;i<input_port_count;i++)
>    {
>      if (ports[i]!=NULL)
>      {
>        if(!jack_connect (client, ports[i],jack_port_name(ioPortArray[j])))

// what is ioPortArray[],  ports[] and how do you query input_port_count?
// more context is needed

>        {
>          fprintf (stderr, "autoconnect: %s -> %s\n",
>            ports[i],jack_port_name(ioPortArray[j])
>          );
>          j++;
>        }
>        else
>        {

// if you get here ports[i] == NULL

>          fprintf (stderr, "autoconnect: failed: %s -> %s\n",
>            ports[i],jack_port_name(ioPortArray[j])
>          );

// ..and hence you pass a null pointer to printf. not nice. 
// (some printf implementation can handle it but don’t count on it).
// This would certainly explain the segfault that you’ve pasted below.

>        }
>      }
>    }
>    fprintf (stderr, "\n");
>  }
> 
>  free (ports);
> —
> 

[..]

> Maybe the client code is buggy. When the client in question is run in gdb,
> this is the output:
> 
> [New Thread 0x7ffff7fa0700 (LWP 6321)]
> autoconnect: system:capture_1 -> send:input_1
> autoconnect: system:capture_2 -> send:input_2
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff73278f3 in _IO_vfprintf_internal (s=s@entry=0x7fffffffc840,
>    format=<optimized out>, format@entry=0x7ffff7bccdbc "%s",
>    ap=ap@entry=0x7fffffffc9a8) at vfprintf.c:1661
> 1661	vfprintf.c: No such file or directory.

get a backtrace here.

best,
robin
PrevNext  Index

1413760846.16871_0.ltw:2, <8A1FA1EE-B4A8-4D54-98FB-FC1E5FEC28A8 at gareus dot org>