[FFmpeg-cvslog] avutil/random_seed: Add the runtime in cycles of the main loop to the entropy pool

Michael Niedermayer git at videolan.org
Thu Apr 28 05:29:18 CEST 2016


ffmpeg | branch: release/2.7 | Michael Niedermayer <michael at niedermayer.cc> | Wed Dec  9 15:18:53 2015 +0100| [91b6d89d0a5ed5ac1aa3ca60d6f8dca93b50d461] | committer: Michael Niedermayer

avutil/random_seed: Add the runtime in cycles of the main loop to the entropy pool

This should theoretically improve the randomness slightly

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 2540d884f3fd7cfac503e048112098967be2569a)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=91b6d89d0a5ed5ac1aa3ca60d6f8dca93b50d461
---

 libavutil/random_seed.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 8aa8c38..5af8e9e 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -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));



More information about the ffmpeg-cvslog mailing list