This function implements a delay using the first available
of the following functions:
- nanosleep()
- usleep()
- Sleep() (Windows)
The conditional #includes in time.c are simplified by including
unistd.h and windows.h whenever they are available rather than
having these lines triggered by specific functions.
Signed-off-by: Mans Rullgard <mans@mansr.com>
The unistd.h header is only needed for the close() declaration.
If this header is not available, the close() declaration may be
provided by another header, e.g. io.h.
Signed-off-by: Mans Rullgard <mans@mansr.com>
The only symbol this file uses from unistd.h is isatty(). By
including the header only when this function is used, the file
can be built on systems without unistd.h (which presumably also
lack isatty).
Signed-off-by: Mans Rullgard <mans@mansr.com>
It's redundant, since the input buffer is passed as a parameter to the
filter_samples() callback, and can lead to stale pointers remaining on
the link.
Its documentation states that it is allocated/freed by the caller, but
it is declared as an AV_OPT_TYPE_STRING AVOption. Since
367732832f the AVOptions system frees
strings automatically. This can be considered an API break, since it
won't work when the caller doesn't use av_malloc() to allocate the
memory or wants to use the string after closing the codec.
Since there is not much value in this field being an AVOption, the best
solution is to remove it from the options table.
While these defines are not defined by the C standard they are
standardized as X/Open System Interfaces Extension. We use the
appropiate _XOPEN_SOURCE define to make them available. They
seem to be available on all FATE configs since the constants
are used in files where mathematics.h is not included.
Also use ff_neterrno() instead of errno directly (which doesn't work
on windows), for getting the error code.
Signed-off-by: Martin Storsjö <martin@martin.st>
getnameinfo doesn't set errno on failure, it returns an error code,
which should be handled by gai_strerror instead of the normal
strerror.
Signed-off-by: Martin Storsjö <martin@martin.st>
Rtmpt is effectively half duplex - the server can't return any
data unless we send a request (to which the server responds). If
we don't have any data to send currently, and the server didn't
return any data either, wait a little before doing the next request.
This avoids busy looping with idle posts with empty replies, while
waiting for more data from the server.
Signed-off-by: Martin Storsjö <martin@martin.st>
The check uses check_func_header, since this function is
conditionally available depending on the targeted MSVCRT
version.
Signed-off-by: Martin Storsjö <martin@martin.st>