Skip to content

Commit 2fd9a32

Browse files
Fixing crash on startup
1 parent 40a0c85 commit 2fd9a32

File tree

2 files changed

+4
-52
lines changed

2 files changed

+4
-52
lines changed

libobs/media-io/video-io.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -582,34 +582,6 @@ void video_output_stop(video_t *video)
582582
}
583583
}
584584

585-
// TODO: OLD version
586-
/*
587-
void video_output_stop(video_t *video)
588-
{
589-
void *thread_ret;
590-
591-
if (!video)
592-
return;
593-
594-
video = get_root(video);
595-
596-
if (!video->stop) {
597-
video->stop = true;
598-
os_sem_post(video->update_semaphore);
599-
pthread_join(video->thread, &thread_ret);
600-
601-
if (video == obs->data.main_canvas->mix->video) {
602-
// The graphics thread must end before mutexes are destroyed
603-
if (obs->video.thread_initialized) {
604-
pthread_join(obs->video.video_thread,
605-
&thread_ret);
606-
obs->video.thread_initialized = false;
607-
}
608-
}
609-
}
610-
}
611-
*/
612-
613585
bool video_output_stopped(video_t *video)
614586
{
615587
if (!video)

libobs/obs.c

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -797,36 +797,13 @@ static int obs_init_video()
797797
return OBS_VIDEO_SUCCESS;
798798
}
799799

800-
// TODO: remove this
801-
/*
802800
static void stop_video(void)
803801
{
804-
//if (obs->data.main_canvas->mix) {
805-
// video_output_stop(obs->data.main_canvas->mix->video);
806-
//}
807-
808802
pthread_mutex_lock(&obs->video.mixes_mutex);
809803
for (size_t i = 0, num = obs->video.mixes.num; i < num; i++)
810804
video_output_stop(obs->video.mixes.array[i]->video);
811805
pthread_mutex_unlock(&obs->video.mixes_mutex);
812806
}
813-
*/
814-
815-
static void stop_video(void)
816-
{
817-
pthread_mutex_lock(&obs->video.mixes_mutex);
818-
for (size_t i = 0, num = obs->video.mixes.num; i < num; i++)
819-
video_output_stop(obs->video.mixes.array[i]->video);
820-
pthread_mutex_unlock(&obs->video.mixes_mutex);
821-
822-
struct obs_core_video *video = &obs->video;
823-
void *thread_retval;
824-
825-
if (video->thread_initialized) {
826-
pthread_join(video->video_thread, &thread_retval);
827-
video->thread_initialized = false;
828-
}
829-
}
830807

831808
static void obs_free_render_textures(struct obs_core_video_mix *video)
832809
{
@@ -915,7 +892,10 @@ static void obs_free_video(bool full_clean)
915892

916893
pthread_mutex_lock(&obs->video.mixes_mutex);
917894
size_t num_views = 0;
918-
for (size_t i = 0; i < obs->video.mixes.num; i++) {
895+
// 0 value of "i" is reserved for the main canvas, which is created first and
896+
// remains present throughout the lifetime of the application.
897+
// As this canvas is unused, we can safely skip it.
898+
for (size_t i = 1; i < obs->video.mixes.num; i++) {
919899
struct obs_core_video_mix *video = obs->video.mixes.array[i];
920900
if (video && video->view)
921901
num_views++;

0 commit comments

Comments
 (0)