@@ -123,6 +123,13 @@ typedef struct FifoMessage {
AVPacket pkt;
} FifoMessage;
+static void fifo_sleep(int64_t duration)
+{
+ for (; duration > 600000000; duration -= 600000000)
+ av_usleep(600000000);
+ av_usleep(duration);
+}
+
static int fifo_thread_write_header(FifoThreadContext *ctx)
{
AVFormatContext *avf = ctx->avf;
@@ -214,9 +221,7 @@ static int fifo_thread_write_packet(FifoThreadContext *ctx, AVPacket *pkt)
if (sleep > 0) {
av_log(avf, AV_LOG_DEBUG, "sleeping %"PRIi64" us\n", sleep);
- for (; sleep > 600000000; sleep -= 600000000)
- av_usleep(600000000);
- av_usleep(sleep);
+ fifo_sleep(sleep);
}
}