Explorar o código

libobs: Initialize randomization seed in video thread

Ensures that any rand() calls in the video thread will have a unique
seed to start from.
jp9000 %!s(int64=8) %!d(string=hai) anos
pai
achega
3ea23320b8
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      libobs/obs-video.c

+ 5 - 0
libobs/obs-video.c

@@ -15,6 +15,9 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/
 
+#include <time.h>
+#include <stdlib.h>
+
 #include "obs.h"
 #include "obs-internal.h"
 #include "graphics/vec4.h"
@@ -599,6 +602,8 @@ void *obs_video_thread(void *param)
 			"obs_video_thread(%g"NBSP"ms)", interval / 1000000.);
 	profile_register_root(video_thread_name, interval);
 
+	srand((unsigned int)time(NULL));
+
 	while (!video_output_stopped(obs->video.video)) {
 		uint64_t frame_start = os_gettime_ns();
 		uint64_t frame_time_ns;