mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-28 16:12:08 -05:00
BPM initialization occurs with the first call to the `bpm_inject()` callback function. When Stream Delay is active, there is a case where the first call might never happen, specifically if a user stops the stream with the discard delay option before streaming begins. In such a case OBS will crash due to an uninitialized mutex being referenced in `bpm_destroy()`. Use `pthread_once()` in both the `bpm_inject()` callback and `bpm_destroy()` to ensure BPM initialization has occurred.