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>
... | ... |
@@ -312,8 +312,8 @@ static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf, |
312 | 312 |
} else { |
313 | 313 |
if (h->rw_timeout) { |
314 | 314 |
if (!wait_since) |
315 |
- wait_since = av_gettime(); |
|
316 |
- else if (av_gettime() > wait_since + h->rw_timeout) |
|
315 |
+ wait_since = av_gettime_relative(); |
|
316 |
+ else if (av_gettime_relative() > wait_since + h->rw_timeout) |
|
317 | 317 |
return AVERROR(EIO); |
318 | 318 |
} |
319 | 319 |
av_usleep(1000); |
... | ... |
@@ -163,8 +163,8 @@ int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterrupt |
163 | 163 |
return ret; |
164 | 164 |
if (timeout > 0) { |
165 | 165 |
if (!wait_start) |
166 |
- wait_start = av_gettime(); |
|
167 |
- else if (av_gettime() - wait_start > timeout) |
|
166 |
+ wait_start = av_gettime_relative(); |
|
167 |
+ else if (av_gettime_relative() - wait_start > timeout) |
|
168 | 168 |
return AVERROR(ETIMEDOUT); |
169 | 169 |
} |
170 | 170 |
} |
... | ... |
@@ -245,7 +245,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt) |
245 | 245 |
{ |
246 | 246 |
AVFormatContext *rtpctx; |
247 | 247 |
struct SAPState *sap = s->priv_data; |
248 |
- int64_t now = av_gettime(); |
|
248 |
+ int64_t now = av_gettime_relative(); |
|
249 | 249 |
|
250 | 250 |
if (!sap->last_time || now - sap->last_time > 5000000) { |
251 | 251 |
int ret = ffurl_write(sap->ann_fd, sap->ann, sap->ann_size); |