exeldro / obs-audio-monitor

audio monitor filter for OBS Studio
GNU General Public License v2.0
282 stars 29 forks source link

Segmentation Fault on start #58

Open ipatix opened 2 years ago

ipatix commented 2 years ago

Hi,

this is the first time I've tried to use this plugin on Linux (Debian Unstable). I followed the instructions to build the plugin and included it in the UI/frontend-plugins CMakeLists.

However, if I try to run OBS with this compilation I get a segmentation fault with the following backtrace:

Thread 12 "audio-io: audio" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffc1dfb640 (LWP 24709)]
0x00007fffda300d10 in AudioOutputControl::OBSOutputAudio(void*, unsigned long, audio_data*) () from /usr/local//lib/obs-plugins/audio-monitor.so
(gdb) bt
#0  0x00007fffda300d10 in AudioOutputControl::OBSOutputAudio(void*, unsigned long, audio_data*) () at /usr/local//lib/obs-plugins/audio-monitor.so
#1  0x00007ffff67bce30 in  () at /usr/local/lib/libobs.so.0
#2  0x00007ffff67bcee7 in  () at /usr/local/lib/libobs.so.0
#3  0x00007ffff3e87b27 in start_thread (arg=<optimized out> at ./nptl/pthread_create.c:435
#4  0x00007ffff3f0a78c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

So far I don't know if there is a workaround to fix this and the plugin is entirely unusable :/

exeldro commented 2 years ago

I never got any linux build working for this plugin that is why on the OBS resource page there is no linux version to download

ipatix commented 1 year ago

Okay, I have more details on this. This segfault occurs because the fancy SIMD code in AudioOutputControl::OBSOutputAudio blindly assumes all the audio buffers are aligned by 16 bytes.

So in the following line there is a _mm_load_ps but the samples pointer is in my case not a multiple 16: https://github.com/exeldro/obs-audio-monitor/blob/9a14f6298893653940fd72a2867dd7b84f41dd02/audio-output-control.cpp#L155

Changing this to _mm_loadu_ps fixes the crash.