From f4c1be48b7abb65c6b6d41394b1bdb83cd76764b Mon Sep 17 00:00:00 2001 From: Exeldro Date: Thu, 25 Apr 2024 13:52:39 +0200 Subject: [PATCH] obs-ffmpeg: Fix deadlock on shutting down muxer --- plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c b/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c index b4e9203bf..4610a454f 100644 --- a/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c +++ b/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c @@ -745,11 +745,11 @@ static void *ffmpeg_mux_io_thread(void *data) // Loop to write in chunk_size chunks for (;;) { + pthread_mutex_lock(&ffm->io.data_mutex); + shutting_down = os_atomic_load_bool( &ffm->io.shutdown_requested); - pthread_mutex_lock(&ffm->io.data_mutex); - // Fetch as many writes as possible from the deque // and fill up our local chunk. This may involve seeking // if ffmpeg needs to, so take care of that as well.