diff options
author | Mans Rullgard <mans@mansr.com> | 2012-06-21 23:31:44 +0400 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-06-22 20:15:36 +0400 |
commit | 896bb0d742a513b1bb5b9a770dbffd2cd436bed6 (patch) | |
tree | bc133c53f4cd418c8b42c6d12958e719900ebb6e /libavformat | |
parent | d3d3a32c9d389cc0d6a91b389988a225ae01c948 (diff) |
Replace usleep() calls with av_usleep()
This reduces the dependency on unistd.h which is not available
on all systems.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avio.c | 5 | ||||
-rw-r--r-- | libavformat/hls.c | 4 | ||||
-rw-r--r-- | libavformat/hlsproto.c | 4 | ||||
-rw-r--r-- | libavformat/rtmphttp.c | 5 |
4 files changed, 8 insertions, 10 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c index 371500e8a6..5acaf30e90 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -19,11 +19,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <unistd.h> - #include "libavutil/avstring.h" #include "libavutil/dict.h" #include "libavutil/opt.h" +#include "libavutil/time.h" #include "os_support.h" #include "avformat.h" #if CONFIG_NETWORK @@ -237,7 +236,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int if (fast_retries) fast_retries--; else - usleep(1000); + av_usleep(1000); } else if (ret < 1) return ret < 0 ? ret : len; if (ret) diff --git a/libavformat/hls.c b/libavformat/hls.c index e876735468..253463edf6 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -30,9 +30,9 @@ #include "libavutil/mathematics.h" #include "libavutil/opt.h" #include "libavutil/dict.h" +#include "libavutil/time.h" #include "avformat.h" #include "internal.h" -#include <unistd.h> #include "avio_internal.h" #include "url.h" @@ -407,7 +407,7 @@ reload: while (av_gettime() - v->last_load_time < reload_interval) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; - usleep(100*1000); + av_usleep(100*1000); } /* Enough time has elapsed since the last reload */ goto reload; diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c index 044b7ffe98..179bdf1967 100644 --- a/libavformat/hlsproto.c +++ b/libavformat/hlsproto.c @@ -26,11 +26,11 @@ */ #include "libavutil/avstring.h" +#include "libavutil/time.h" #include "avformat.h" #include "internal.h" #include "url.h" #include "version.h" -#include <unistd.h> /* * An apple http stream consists of a playlist with media segment files, @@ -308,7 +308,7 @@ retry: while (av_gettime() - s->last_load_time < reload_interval) { if (ff_check_interrupt(&h->interrupt_callback)) return AVERROR_EXIT; - usleep(100*1000); + av_usleep(100*1000); } goto retry; } diff --git a/libavformat/rtmphttp.c b/libavformat/rtmphttp.c index 544b493500..499341a173 100644 --- a/libavformat/rtmphttp.c +++ b/libavformat/rtmphttp.c @@ -24,11 +24,10 @@ * RTMP HTTP protocol */ -#include <unistd.h> - #include "libavutil/avstring.h" #include "libavutil/intfloat.h" #include "libavutil/opt.h" +#include "libavutil/time.h" #include "internal.h" #include "http.h" @@ -126,7 +125,7 @@ static int rtmp_http_read(URLContext *h, uint8_t *buf, int size) if (rt->nb_bytes_read == 0) { /* Wait 50ms before retrying to read a server reply in * order to reduce the number of idle requets. */ - usleep(50000); + av_usleep(50000); } if ((ret = rtmp_http_write(h, "", 1)) < 0) |