aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorOlivier Langlois <olivier@trillion01.com>2014-05-06 17:16:51 -0400
committerMichael Niedermayer <michaelni@gmx.at>2014-05-17 20:13:33 +0200
commitf78bc96b7c1c74caf99a7139cf81ce1110404965 (patch)
treef160505f5f94cc30a1ce0f04fb643f82563470d4 /libavformat
parent9986e50a6ec8b4500557c3b17188615558a76069 (diff)
downloadffmpeg-f78bc96b7c1c74caf99a7139cf81ce1110404965.tar.gz
lavf: Use av_gettime_relative()
Whenever av_gettime() is used to measure relative period of time, av_gettime_relative() is prefered as it guarantee monotonic time on supported platforms. Signed-off-by: Olivier Langlois <olivier@trillion01.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avio.c4
-rw-r--r--libavformat/network.c4
-rw-r--r--libavformat/sapenc.c2
3 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 4edaaa6215..0a2a0a9aab 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -312,8 +312,8 @@ static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
} else {
if (h->rw_timeout) {
if (!wait_since)
- wait_since = av_gettime();
- else if (av_gettime() > wait_since + h->rw_timeout)
+ wait_since = av_gettime_relative();
+ else if (av_gettime_relative() > wait_since + h->rw_timeout)
return AVERROR(EIO);
}
av_usleep(1000);
diff --git a/libavformat/network.c b/libavformat/network.c
index 5e574e3bbe..9f02ec6c51 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -163,8 +163,8 @@ int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterrupt
return ret;
if (timeout > 0) {
if (!wait_start)
- wait_start = av_gettime();
- else if (av_gettime() - wait_start > timeout)
+ wait_start = av_gettime_relative();
+ else if (av_gettime_relative() - wait_start > timeout)
return AVERROR(ETIMEDOUT);
}
}
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index 738e8b8f91..2564698e7b 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -245,7 +245,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVFormatContext *rtpctx;
struct SAPState *sap = s->priv_data;
- int64_t now = av_gettime();
+ int64_t now = av_gettime_relative();
if (!sap->last_time || now - sap->last_time > 5000000) {
int ret = ffurl_write(sap->ann_fd, sap->ann, sap->ann_size);