mirror of https://git.ffmpeg.org/ffmpeg.git
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@niedermayer.cc>
(cherry picked from commit c4152fc42e
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
f0862b18c5
commit
8c3e90f5ed
|
@ -87,7 +87,7 @@ static uint32_t get_generic_seed(void)
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
clock_t t = clock();
|
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;
|
last_td = t - last_t;
|
||||||
buffer[i & 511] = 1664525*buffer[i & 511] + 1013904223 + (last_td % 3294638521U);
|
buffer[i & 511] = 1664525*buffer[i & 511] + 1013904223 + (last_td % 3294638521U);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue