random_seed: Rewrite the generic clock() based seed code

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>
configure: Disable networking if winsock2.h is available but winsock functions aren't

Previously, if neither of the checks for the closesocket function
succeeded, we still kept winsock2.h and networking in general
enabled.

When targeting the WinRT API subset, the winsock2.h header is
available (making the check for it succeed, giving the impression
that winsock is available), but tests that actually try to use
such a function will fail. In this case, disable the winsock2.h
feature and networking in general, as if the winsock2.h header
test would have failed in the first place.

Signed-off-by: Martin Storsjö <martin@martin.st>
Merge commit '01d245ef4392152dbdc78a6ba4dfa0a6e8b08e6f'

* commit '01d245ef4392152dbdc78a6ba4dfa0a6e8b08e6f':
  random_seed: Rewrite the generic clock() based seed code

Conflicts:
	libavutil/random_seed.c

See: 66531c75d3bfd8a013acd8bd3c04a131dae2a1a0
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '9409c9bdbfd829353473ee6cc3e91c726481c069'

* commit '9409c9bdbfd829353473ee6cc3e91c726481c069':
  configure: Disable networking if winsock2.h is available but winsock functions aren't

Merged-by: Michael Niedermayer <michaelni@gmx.at>
avformat/nutdec: check avio_read() return code

Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f2785ab8669_6838_mewmew_vorbis_ssa.nut
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/rmdec: check that sub_packet_size fit in the packet for DEINT_ID_GENR

Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7fa8c49400d0_3923_audiosig.rm
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>