Hello, fellow Jack developers.

I am currently writing a jack client which is loaded from within the unity3d game engine. It's supposed to work like this: Every time, jack requests audio, unity3d generates it. This is done in order to bypass the unity3d audio renderer and use the audio in different applications instead.

Technically, everything works fine so far. When the software is started, either from within the unity3d editor or directly as a compiled unity3d application, the client appears in QJackCtl and I can route the channels to wherever I want and even hear the audio.

BUT: the client randomly disables. At some point during runtime (both in the built version and directly from the editor) it happens, that the routing disconnects itself, and I am unable to reconnect it. When I try, I get the message "Cannot connect ports owned by inactive clients: "Unity" is not active".

This behavior seems to be very unpredictable, sometimes it happens after just a second, sometimes it runs fine for over a minute or two. Sometimes it does not even happen (or I did not wait long enough).

I have experienced this behavior both writing my own framework or by using the JackSharp framework. The behavior also does not change when uninstalling pulseaudio (which was sort of a last guess on our end).

The same behavior occurs when I use jack with a dummy driver. The connection is established and randomly breaks down again. (although obviously I can't hear the sound).

Interestingly: when I use the framework as a standalone version, everything seems to work fine. Therefore, it kind of seems obvious, that it has to have to do something with Unity or the fact, that the framework is called from a different thread or something like that. However, Unity does not report any problems.

What I can see in the QJackCtl Log: The exact moment the problem occurs, the kPortRegistrationOff Method is called on all ports. It looks like the server disables all ports, then tries to deactivate the client and therefore destroying all the ports. It eventually proceeds to tell, that the client was destroyed successfully and that's it.

I have implemented all the callbacks that are available from the API (at least all that i think where usefull) but all I get is, that the framework receives the jack_on_info_shutdown method is called. This method is passed a const char argument which is supposed to hold the reason, but all it says is : "JACK server has been closed". Which it is not. It is still running.

At this point, I am out of ideas of what to do to narrow down the problem.

I have tested other applications (like Reaper) and they work fine.

I am using Ubuntu 20.04, both on low-latency or generic kernel > 5.14

I use the latest version of jack2 (as of Dec 22)

I know all this sounds very vague and overly complex, but I have no idea what else to look for or which information may be necessary to further investigate the problem.

Any help at all is highly appreciated.

Thank you all very much

Have a nice day

Benny