Forgot to seed srandom()
authorNathan Caldwell <saintdev@gmail.com>
Tue, 13 Jan 2009 07:15:39 +0000 (13 00:15 -0700)
committerNathan Caldwell <saintdev@gmail.com>
Tue, 13 Jan 2009 07:15:39 +0000 (13 00:15 -0700)
src/matroska.c

index 624d7e3..3b6c5ce 100644 (file)
@@ -25,6 +25,8 @@
 #include "matroska.h"
 #include "md5.h"
 
+#include <sys/time.h>
+
 #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;