From ec24712c6da006eb166cb9df85df0b6c1e7ac806 Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Thu, 18 Aug 2022 23:17:48 +0200 Subject: [PATCH] libobs: Initialize main_view video mix before video thread Fixes a race condition where the video thread would exit because it sees no active mixes, causing OBS to freeze on startup. Fixes #7095 --- libobs/obs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libobs/obs.c b/libobs/obs.c index 83ef5058a663..cef1ae98e60f 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -646,6 +646,11 @@ static int obs_init_video(struct obs_video_info *ovi) if (pthread_mutex_init(&video->mixes_mutex, NULL) < 0) return OBS_VIDEO_FAIL; + video->ovi = *ovi; + + if (!obs_view_add(&obs->data.main_view)) + return OBS_VIDEO_FAIL; + int errorcode; #ifdef __APPLE__ errorcode = pthread_create(&video->video_thread, NULL, @@ -658,10 +663,6 @@ static int obs_init_video(struct obs_video_info *ovi) return OBS_VIDEO_FAIL; video->thread_initialized = true; - video->ovi = *ovi; - - if (!obs_view_add(&obs->data.main_view)) - return OBS_VIDEO_FAIL; return OBS_VIDEO_SUCCESS; }