Commit 5abfed7
Fix volmeter teardown deadlock between audio thread and IPC (#1718)
OBSCallback runs while libobs holds the volmeter callback_mutex, then takes
the osn global mtx (and the manager's internal_mutex via find). The teardown
paths acquire those osn locks first and then take callback_mutex:
- Destroy holds mtx, then obs_volmeter_remove_callback -> callback_mutex
- ClearVolmeters' for_each holds internal_mutex, then
obs_volmeter_remove_callback -> callback_mutex
This is two AB-BA cycles (callback_mutex<->mtx, callback_mutex<->internal_mutex)
that can hang on shutdown while audio is still flowing.
- OBSCallback now try_locks mtx and drops the update if busy, so the audio
thread never blocks on mtx while holding callback_mutex.
- ClearVolmeters collects the volmeters under the manager lock, then removes
callbacks and clears outside for_each, so callback_mutex is never taken while
the manager lock is held.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3e3f941 commit 5abfed7
1 file changed
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
154 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
155 | 164 | | |
156 | 165 | | |
157 | 166 | | |
| |||
0 commit comments