0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
obs-studio/plugins/linux-jack
Hector Martin 9616b79026 linux-jack: fix deadlock when closing the client
This lock causes a deadlock when freeing the JACK client while a
process callback is pending:

deactivate_jack -> locks mutex
   JACK thread -> calls jack_process_callback
   jack_process_callback -> blocks on mutex
jack_client_close -> joins JACK thread
(deadlock as the process callback never returns)

Instead, just don't lock the mutex. This is only mutexing on
creation/destruction of the JACK client. This is not necessary: the
process callback will only run after jack_activate (which is right
before the mutex is released in jack_init()), and will stop running
by the time jack_client_close returns. We don't actually need to
unregister any ports, so just call jack_client_close first thing in
deactivate_jack, which will guarantee the process callback has
completed before returning.

In fact, jack_process_callback isn't allowed to lock any mutexes or
allocate any memory at all, so this plug-in is still broken in this way
as obs_source_output_audio does that. This can cause audio xruns, as
realtime guarantees are violated. This is something that should be
fixed in the future, but at least it's not a deadlock.
2021-01-03 11:08:58 -08:00
..
data/locale Update translations from Crowdin 2020-12-14 00:29:44 +01:00
CMakeLists.txt cmake: Add cmake folders 2020-05-13 06:52:37 -07:00
jack-input.c UI: Add source icons 2019-11-24 20:50:42 -08:00
jack-wrapper.c linux-jack: fix deadlock when closing the client 2021-01-03 11:08:58 -08:00
jack-wrapper.h clang-format: Apply formatting 2019-06-23 23:49:10 -07:00
linux-jack.c Plugins: Add descriptions to modules 2018-09-11 18:28:58 -07:00