Przeglądaj źródła

libobs: Pump graphics loop one final time for cleanup

jpark37 5 lat temu
rodzic
commit
3703581472
1 zmienionych plików z 8 dodań i 1 usunięć
  1. 8 1
      libobs/obs-video.c

+ 8 - 1
libobs/obs-video.c

@@ -844,7 +844,11 @@ void *obs_graphics_thread(void *param)
 
 	srand((unsigned int)time(NULL));
 
-	while (!video_output_stopped(obs->video.video)) {
+	for (;;) {
+		/* defer loop break to clean up sources */
+		const bool stop_requested =
+			video_output_stopped(obs->video.video);
+
 		uint64_t frame_start = os_gettime_ns();
 		uint64_t frame_time_ns;
 		bool raw_active = obs->video.raw_active > 0;
@@ -920,6 +924,9 @@ void *obs_graphics_thread(void *param)
 			fps_total_ns = 0;
 			fps_total_frames = 0;
 		}
+
+		if (stop_requested)
+			break;
 	}
 
 	UNUSED_PARAMETER(param);