i-rinat / apulse

PulseAudio emulation for ALSA
MIT License
611 stars 35 forks source link

segfault with obs-studio #29

Open OrdinaryMagician opened 9 years ago

OrdinaryMagician commented 9 years ago

When adding an input or output source from pulseaudio in obs-studio, the whole thing segfaults. A simple test with ffmpeg recording works fine, so I can confirm my setup is properly configured. Trace information shows all this:

1432303328.743 [apulse 23775] F pa_threaded_mainloop_new (void)
1432303328.743 [apulse 23775] F pa_mainloop_new (void)
1432303328.743 [apulse 23775] F pa_mainloop_set_poll_func m=0x3e744f0, poll_func=0x7f2bd83796da, userdata=0x3e74478
1432303328.743 [apulse 23775] F pa_threaded_mainloop_start m=0x3e74470
1432303328.743 [apulse 23823] F pa_mainloop_run
1432303328.743 [apulse 23775] F pa_threaded_mainloop_lock m=0x3e74470
1432303328.743 [apulse 23823] F pa_mainloop_iterate m=0x3e744f0, block=1
1432303328.744 [apulse 23823] P pa_mainloop_prepare m=0x3e744f0, timeout=1000
1432303328.744 [apulse 23823] F pa_mainloop_poll m=0x3e744f0
1432303328.744 [apulse 23775] F pa_proplist_new (void)
1432303328.744 [apulse 23775] F pa_proplist_sets p=0x3e7b260, key=application.name, value=OBS
1432303328.744 [apulse 23775] F pa_proplist_sets p=0x3e7b260, key=application.icon_name, value=obs
1432303328.744 [apulse 23775] F pa_proplist_sets p=0x3e7b260, key=media.role, value=production
1432303328.744 [apulse 23775] F pa_threaded_mainloop_get_api m=0x3e74470
1432303328.744 [apulse 23775] F pa_context_new_with_proplist mainloop_api=0x3e744f0, name=OBS, proplist=0x3e7b260
1432303328.744 [apulse 23775] F pa_context_set_state_callback c=0x3e330d0, cb=0x7f2baceb6660, userdata=(nil)
1432303328.744 [apulse 23775] P pa_context_connect c=0x3e330d0, server=(null), flags=1, api=(nil)
1432303328.744 [apulse 23775] F pa_context_ref c=0x3e330d0
1432303328.744 [apulse 23775] F ml_api_defer_new
1432303328.744 [apulse 23775] F pa_mainloop_wakeup m=0x3e744f0
1432303328.744 [apulse 23775] F pa_proplist_free p=0x3e7b260
1432303328.744 [apulse 23775] F pa_threaded_mainloop_unlock m=0x3e74470
1432303328.744 [apulse 23775] F pa_threaded_mainloop_lock m=0x3e74470
1432303328.744 [apulse 23823] F pa_mainloop_dispatch m=0x3e744f0
1432303328.744 [apulse 23823] F pa_threaded_mainloop_signal m=0x3e74470, wait_for_accept=0
1432303328.744 [apulse 23823] F pa_context_unref c=0x3e330d0
1432303328.744 [apulse 23823] F pa_mainloop_iterate m=0x3e744f0, block=1
1432303328.744 [apulse 23823] P pa_mainloop_prepare m=0x3e744f0, timeout=1000
1432303328.744 [apulse 23823] F pa_mainloop_poll m=0x3e744f0
1432303328.744 [apulse 23775] F pa_context_get_state c=0x3e330d0
1432303328.744 [apulse 23775] F pa_context_get_state c=0x3e330d0
1432303328.744 [apulse 23775] F pa_threaded_mainloop_unlock m=0x3e74470
1432303328.744 [apulse 23775] F pa_threaded_mainloop_lock m=0x3e74470
1432303328.744 [apulse 23775] Z pa_context_get_server_info
1432303328.744 [apulse 23775] F pa_operation_get_state o=(nil)

I'm not really very experienced with all this so I can't really tell what the source of the problem could be. All I see is that line 131 in apulse-operation.c is dereferencing a null pointer.

i-rinat commented 9 years ago

Here is not implemented pa_context_get_server_info which returns NULL, which is then dereferenced in pa_operation_get_state. One need to make pa_context_get_server_info to perform what it should do, and return appropriate pa_operation handle.

Enzime commented 8 years ago

For obs-studio, you can try https://github.com/CkNoSFeRaTU/obs-studio/tree/alsa-input which is a branch that supports ALSA devices in OBS.