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>
This commit is contained in:
Mans Rullgard
2012-06-21 20:31:44 +01:00
parent d3d3a32c9d
commit 896bb0d742
8 changed files with 18 additions and 19 deletions

View File

@@ -27,7 +27,6 @@
#include <errno.h>
#include <signal.h>
#include <limits.h>
#include <unistd.h>
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
@@ -45,6 +44,7 @@
#include "libavutil/avstring.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "libavutil/time.h"
#include "libavformat/os_support.h"
# include "libavfilter/avfilter.h"
@@ -1876,7 +1876,7 @@ static void rate_emu_sleep(InputStream *ist)
int64_t pts = av_rescale(ist->last_dts, 1000000, AV_TIME_BASE);
int64_t now = av_gettime() - ist->start;
if (pts > now)
usleep(pts - now);
av_usleep(pts - now);
}
}
@@ -2793,7 +2793,7 @@ static void *input_thread(void *arg)
ret = av_read_frame(f->ctx, &pkt);
if (ret == AVERROR(EAGAIN)) {
usleep(10000);
av_usleep(10000);
ret = 0;
continue;
} else if (ret < 0)
@@ -2948,7 +2948,7 @@ static int transcode(void)
if (no_packet_count) {
no_packet_count = 0;
memset(no_packet, 0, nb_input_files);
usleep(10000);
av_usleep(10000);
continue;
}
av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from, finishing.\n");