summaryrefslogtreecommitdiff
path: root/libavutil/random_seed.c
Commit message (Collapse)AuthorAgeFilesLines
* random_seed: Rewrite the generic clock() based seed codeMichael Niedermayer2014-01-061-21/+30
| | | | | | | | | | | | | | | | | | The new code is faster and reuses the previous state in case of multiple calls. The previous code could easily end up in near-infinite loops, if the difference between two clock() calls never was larger than 1. This makes fate-parseutils finish in finite time when run in wine, if CryptGenRandom isn't available (which e.g. isn't available if targeting Windows RT/metro). Patch originally by Michael Niedermayer but with some modifications by Martin Storsjö. Signed-off-by: Martin Storsjö <martin@martin.st>
* libavutil: use avpriv_open()Rémi Denis-Courmont2013-08-071-1/+2
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* random_seed: Support using CryptGenRandom on windowsMartin Storsjö2012-10-111-0/+15
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* random_seed: Only read /dev/*random if we have unistd.hRonald S. Bultje2012-06-291-0/+8
| | | | | | | | unistd.h is used for open/read/close, but if this header does not exist, there's probably no use in trying to open /dev/*random at all. Signed-off-by: Martin Storsjö <martin@martin.st>
* Code clean-up for crc.c, lfg.c, log.c, random_see.d, rational.c and tree.c.Yordan Makariev2011-12-031-14/+14
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* random_seed: use proper #includesMans Rullgard2011-07-171-2/+2
| | | | | | Use <> for system headers, add needed math.h, drop unnecessary avutil.h. Signed-off-by: Mans Rullgard <mans@mansr.com>
* lavu: remove disabled ff_random_get_seed cruft.Anton Khirnov2011-04-191-8/+0
|
* Replace FFmpeg with Libav in licence headersMans Rullgard2011-03-191-4/+4
| | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
* Fix infinite loop with clock() returning (clock_t)-1.Michael Niedermayer2010-07-081-6/+6
| | | | Originally committed as revision 24116 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Change i to unsigned in get_generic_seed().Michael Niedermayer2010-07-081-2/+2
| | | | | | | This is clearer than comparing against an unsigned number to force an unsigned comparison that we need. Originally committed as revision 24114 to svn://svn.ffmpeg.org/ffmpeg/trunk
* get_generic_seed() for the cases without /dev/random and AV_READ_TIMEMichael Niedermayer2010-07-071-6/+34
| | | | Originally committed as revision 24102 to svn://svn.ffmpeg.org/ffmpeg/trunk
* random_seed: simplifyMåns Rullgård2010-07-011-5/+3
| | | | Originally committed as revision 23932 to svn://svn.ffmpeg.org/ffmpeg/trunk
* ReindentMåns Rullgård2010-07-011-1/+1
| | | | Originally committed as revision 23931 to svn://svn.ffmpeg.org/ffmpeg/trunk
* random_seed: allow to block on /dev/randomMåns Rullgård2010-07-011-3/+0
| | | | | | | | | | If both /dev/random and /dev/urandom failed to return data, an uninitialised value might be returned. Since most systems have a non-blocking /dev/urandom or have /dev/random with similar properties, the chance of blocking is minimal, and the alternative of returning non-random data is worse. Originally committed as revision 23930 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Make av_get_random_seed() non-blockingMåns Rullgård2010-06-301-10/+24
| | | | | | | Attempt to read from /dev/urandom and /dev/random with O_NONBLOCK set. If neither succeeds, proceed with fallbacks. Originally committed as revision 23903 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Make ff_random_get_seed public, rename to av_get_random_seed, export the headerMartin Storsjö2010-05-231-1/+10
| | | | | | | Keep an old ff_ named function for binary compatibility until the next major bump. Originally committed as revision 23254 to svn://svn.ffmpeg.org/ffmpeg/trunk
* indentMåns Rullgård2010-03-111-1/+1
| | | | Originally committed as revision 22451 to svn://svn.ffmpeg.org/ffmpeg/trunk
* random_seed: try other alternatives if reading /dev/random failsMåns Rullgård2010-03-111-1/+2
| | | | Originally committed as revision 22450 to svn://svn.ffmpeg.org/ffmpeg/trunk
* add ff_random_get_seed to be used in conjunction with random functionsBaptiste Coudurier2009-03-081-0/+43
Originally committed as revision 17868 to svn://svn.ffmpeg.org/ffmpeg/trunk