avutil/random_seed: Add the runtime in cycles of the main loop to the entropy pool
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 9 Dec 2015 14:18:53 +0000 (15:18 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 10 Mar 2016 21:56:37 +0000 (22:56 +0100)
This should theoretically improve the randomness slightly

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavutil/random_seed.c

index 205a636..0821550 100644 (file)
@@ -97,8 +97,13 @@ static uint32_t get_generic_seed(void)
         last_t = t;
     }
 
-    if(TEST)
+    if(TEST) {
         buffer[0] = buffer[1] = 0;
+    } else {
+#ifdef AV_READ_TIME
+        buffer[111] += AV_READ_TIME();
+#endif
+    }
 
     av_sha_init(sha, 160);
     av_sha_update(sha, (const uint8_t *)buffer, sizeof(buffer));