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
master
Richard Stanway 2022-08-18 23:17:48 +02:00 committed by Jim
parent f5be6f5fdd
commit 8227dccf77
1 changed files with 5 additions and 4 deletions

View File

@ -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;
}