提交 3ea23320 编写于 作者: J jp9000

libobs: Initialize randomization seed in video thread

Ensures that any rand() calls in the video thread will have a unique
seed to start from.
上级 e5d660e9
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/ ******************************************************************************/
#include <time.h>
#include <stdlib.h>
#include "obs.h" #include "obs.h"
#include "obs-internal.h" #include "obs-internal.h"
#include "graphics/vec4.h" #include "graphics/vec4.h"
...@@ -599,6 +602,8 @@ void *obs_video_thread(void *param) ...@@ -599,6 +602,8 @@ void *obs_video_thread(void *param)
"obs_video_thread(%g"NBSP"ms)", interval / 1000000.); "obs_video_thread(%g"NBSP"ms)", interval / 1000000.);
profile_register_root(video_thread_name, interval); profile_register_root(video_thread_name, interval);
srand((unsigned int)time(NULL));
while (!video_output_stopped(obs->video.video)) { while (!video_output_stopped(obs->video.video)) {
uint64_t frame_start = os_gettime_ns(); uint64_t frame_start = os_gettime_ns();
uint64_t frame_time_ns; uint64_t frame_time_ns;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册