From 3f9e74e55f8927705aa0544adbb0b6d690f5f84a Mon Sep 17 00:00:00 2001 From: Nathan Caldwell Date: Tue, 13 Jan 2009 00:15:39 -0700 Subject: [PATCH] Forgot to seed srandom() --- src/matroska.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/matroska.c b/src/matroska.c index 624d7e3..3b6c5ce 100644 --- a/src/matroska.c +++ b/src/matroska.c @@ -25,6 +25,8 @@ #include "matroska.h" #include "md5.h" +#include + #define RESERVED_SEEKHEAD 0x100 /* 256 bytes should be enough room for our Seek entries. */ #define RESERVED_CHAPTERS 0x800 @@ -82,6 +84,8 @@ mk_Writer *mk_createWriter(const char *filename, int64_t timescale, uint8_t vlc_compat) { mk_Writer *w = calloc(1, sizeof(*w)); + struct timeval tv; + if (w == NULL) return NULL; @@ -114,6 +118,9 @@ mk_Writer *mk_createWriter(const char *filename, int64_t timescale, return NULL; } + gettimeofday( &tv, NULL ); + srandom(tv.tv_sec ^ tv.tv_usec); + w->timescale = timescale; w->vlc_compat = vlc_compat; -- 2.11.4.GIT