[FFmpeg-cvslog] avutil/random_seed: Reduce the time needed on systems with very low precission clock()
Michael Niedermayer
git at videolan.org
Thu Jan 26 02:14:35 EET 2017
ffmpeg | branch: release/3.2 | Michael Niedermayer <michael at niedermayer.cc> | Sat Dec 24 14:26:41 2016 +0100| [ceeeccc86211f072574760cd81b70726d991ad76] | committer: Michael Niedermayer
avutil/random_seed: Reduce the time needed on systems with very low precission clock()
This should fix issues on BSD
CLOCKS_PER_SEC is 128 on BSD while SUSv2 requires it to be a million
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c4152fc42e480c41efb7f761b1bbe5f0bc43d5bc)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ceeeccc86211f072574760cd81b70726d991ad76
---
libavutil/random_seed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index bb3f7be..0cabd1c 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -87,7 +87,7 @@ static uint32_t get_generic_seed(void)
for (;;) {
clock_t t = clock();
- if (last_t + 2*last_td + 1 >= t) {
+ if (last_t + 2*last_td + (CLOCKS_PER_SEC > 1000) >= t) {
last_td = t - last_t;
buffer[i & 511] = 1664525*buffer[i & 511] + 1013904223 + (last_td % 3294638521U);
} else {
More information about the ffmpeg-cvslog
mailing list