dagargo / overwitch

JACK client for Overbridge devices
GNU General Public License v3.0
120 stars 14 forks source link

Clear internal buffers on Bitwig driver model change #53

Closed dagargo closed 5 months ago

dagargo commented 8 months ago

image

Originally posted by @ianhundere in https://github.com/dagargo/overwitch/issues/51#issuecomment-1771083169

Detecting the Bitwig driver change was implemented by listening to JACK client deregistrations which was causing full DLL resets and audio dropouts.

The issue is that other clients deregistrations even while being unconnected to Overwitch are able to reset it.

dagargo commented 8 months ago

I've just pushed a commit to change how driver changes are handled. Now, Overwitch listens to connections and whenever a connection is unmade and there are no more connections, all buffers are cleared.

@ianhundere, could you please give it a try?

ianhundere commented 6 months ago

sorry for the delay, but here are the results using the master branch when trying to change the driver model (e.g. pipewire to jack etc):

❯ overwitch
ERROR:jclient.c:65:(jclient_thread_xrun_cb): JACK xrun
ERROR:jclient.c:65:(jclient_thread_xrun_cb): JACK xrun
ERROR:jclient.c:65:(jclient_thread_xrun_cb): JACK xrun
ERROR:jclient.c:65:(jclient_thread_xrun_cb): JACK xrun
ERROR:jclient.c:65:(jclient_thread_xrun_cb): JACK xrun

bitwig vers is 5.1.2 and pipewire:

❯ pipewire --version
pipewire
Compiled with libpipewire 1.0.0
Linked with libpipewire 1.0.0
dagargo commented 6 months ago

I can confirm this. It's very likely the same as in #51. Still doing some research.

$ pipewire --version
pipewire
Compiled with libpipewire 1.0.0
Linked with libpipewire 1.0.0

$ gdb overwitch
[...]
(gdb) r -vv
[...]
Thread 23 "overwitch" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd0ff96c0 (LWP 69794)]
0x000055555555b36d in jclient_copy_o2j_audio (desc=0x555555698cb0, buffer=0x7fffd0ff05b0, nframes=64, f=0x7fffcc0350c8) at jclient.c:318
318       buffer[j][i] = *f;
(gdb) print buffer
$1 = (jack_default_audio_sample_t **) 0x7fffd0ff05b0
(gdb) bt
#0  0x000055555555b36d in jclient_copy_o2j_audio (desc=0x555555698cb0, buffer=0x7fffd0ff05b0, nframes=64, f=0x7fffcc0350c8)
    at jclient.c:318
#1  jclient_process_cb (nframes=64, arg=0x555555965520) at jclient.c:377
#2  0x00007ffff776ef26 in  () at /usr/lib/x86_64-linux-gnu/pipewire-0.3/jack/libjack.so.0
#3  0x00007ffff5adebae in  () at /usr/lib/x86_64-linux-gnu/spa-0.2/support/libspa-support.so
#4  0x00007ffff68bd030 in  () at /lib/x86_64-linux-gnu/libpipewire-0.3.so.0
#5  0x00007ffff7419044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#6  0x00007ffff749961c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
dagargo commented 5 months ago

I haven't managed to break it again with PipeWire 1.0.1.

As this might be a PipeWire issue, I consider this issue as solved. Please, reopen if needed.

I'm proceeding with the release of version 1.1.