diff --git a/libavformat/hls.c b/libavformat/hls.c index 290f12e5bbbff179079bfd71ffb1c1a02c34b23d..8b52a35508606cd1927af46f61805a85c85897c9 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -320,7 +320,7 @@ static int parse_playlist(HLSContext *c, const char *url, } } if (var) - var->last_load_time = av_gettime(); + var->last_load_time = av_gettime_relative(); fail: av_free(new_url); @@ -392,7 +392,7 @@ restart: reload: if (!v->finished && - av_gettime() - v->last_load_time >= reload_interval) { + av_gettime_relative() - v->last_load_time >= reload_interval) { if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) return ret; /* If we need to reload the playlist again below (if @@ -409,7 +409,7 @@ reload: if (v->cur_seq_no >= v->start_seq_no + v->n_segments) { if (v->finished) return AVERROR_EOF; - while (av_gettime() - v->last_load_time < reload_interval) { + while (av_gettime_relative() - v->last_load_time < reload_interval) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_usleep(100*1000); diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c index ec357de94fd865fb00cb7bbd042382e573a1d27d..751fef2e4d9bbb83f11916a82c7d5a88c57c5948 100644 --- a/libavformat/hlsproto.c +++ b/libavformat/hlsproto.c @@ -169,7 +169,7 @@ static int parse_playlist(URLContext *h, const char *url) } } } - s->last_load_time = av_gettime(); + s->last_load_time = av_gettime_relative(); fail: avio_close(in); @@ -273,7 +273,7 @@ start: s->target_duration; retry: if (!s->finished) { - int64_t now = av_gettime(); + int64_t now = av_gettime_relative(); if (now - s->last_load_time >= reload_interval) { if ((ret = parse_playlist(h, s->playlisturl)) < 0) return ret; @@ -292,7 +292,7 @@ retry: if (s->cur_seq_no - s->start_seq_no >= s->n_segments) { if (s->finished) return AVERROR_EOF; - while (av_gettime() - s->last_load_time < reload_interval) { + while (av_gettime_relative() - s->last_load_time < reload_interval) { if (ff_check_interrupt(&h->interrupt_callback)) return AVERROR_EXIT; av_usleep(100*1000); diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 76228be48dcfceb062a4afc2d80276b4edb3dbda..b5e5200cd752b38c814b61ae14d0a64c895e6c33 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -135,7 +135,7 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, return AVERROR_INVALIDDATA; } - s->last_rtcp_reception_time = av_gettime(); + s->last_rtcp_reception_time = av_gettime_relative(); s->last_rtcp_ntp_time = AV_RB64(buf + 8); s->last_rtcp_timestamp = AV_RB32(buf + 16); if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) { @@ -315,7 +315,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd, avio_wb32(pb, 0); /* delay since last SR */ } else { uint32_t middle_32_bits = s->last_rtcp_ntp_time >> 16; // this is valid, right? do we need to handle 64 bit values special? - uint32_t delay_since_last = av_rescale(av_gettime() - s->last_rtcp_reception_time, + uint32_t delay_since_last = av_rescale(av_gettime_relative() - s->last_rtcp_reception_time, 65536, AV_TIME_BASE); avio_wb32(pb, middle_32_bits); /* last SR timestamp */ @@ -440,7 +440,7 @@ int ff_rtp_send_rtcp_feedback(RTPDemuxContext *s, URLContext *fd, /* Send new feedback if enough time has elapsed since the last * feedback packet. */ - now = av_gettime(); + now = av_gettime_relative(); if (s->last_feedback_time && (now - s->last_feedback_time) < MIN_FEEDBACK_INTERVAL) return 0; @@ -683,7 +683,7 @@ static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len) packet = av_mallocz(sizeof(*packet)); if (!packet) return; - packet->recvtime = av_gettime(); + packet->recvtime = av_gettime_relative(); packet->seq = seq; packet->len = len; packet->buf = buf; @@ -761,7 +761,7 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt, } if (s->st) { - int64_t received = av_gettime(); + int64_t received = av_gettime_relative(); uint32_t arrival_ts = av_rescale_q(received, AV_TIME_BASE_Q, s->st->time_base); timestamp = AV_RB32(buf + 4); diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 52f52a1056783ecd407ceca8a5afd45063a53526..123d5431f96063ae2be5b86d12c91a1395e02142 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1179,7 +1179,7 @@ start: } ffurl_write(rt->rtsp_hd_out, ptr, strlen(ptr)); - rt->last_cmd_time = av_gettime(); + rt->last_cmd_time = av_gettime_relative(); /* Even if the request from the server had data, it is not the data * that the caller wants or expects. The memory could also be leaked * if the actual following reply has content data. */ @@ -1276,7 +1276,7 @@ static int rtsp_send_cmd_with_content_async(AVFormatContext *s, } ffurl_write(rt->rtsp_hd_out, send_content, send_content_length); } - rt->last_cmd_time = av_gettime(); + rt->last_cmd_time = av_gettime_relative(); return 0; } @@ -1851,7 +1851,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, for (;;) { if (ff_check_interrupt(&s->interrupt_callback)) return AVERROR_EXIT; - if (wait_end && wait_end - av_gettime() < 0) + if (wait_end && wait_end - av_gettime_relative() < 0) return AVERROR(EAGAIN); max_p = 0; if (rt->rtsp_hd) { @@ -2050,7 +2050,7 @@ redo: break; case RTSP_LOWER_TRANSPORT_CUSTOM: if (first_queue_st && rt->transport == RTSP_TRANSPORT_RTP && - wait_end && wait_end < av_gettime()) + wait_end && wait_end < av_gettime_relative()) len = AVERROR(EAGAIN); else len = ffio_read_partial(s->pb, rt->recvbuf, RECVBUF_SIZE); diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index aa016c31946e1f7296f225c2a41d589f8cca0c01..1f90590c89deb959c09abf2e266173660b7c19bf 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -885,7 +885,7 @@ retry: if (!(rt->rtsp_flags & RTSP_FLAG_LISTEN)) { /* send dummy request to keep TCP connection alive */ - if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2 || + if ((av_gettime_relative() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2 || rt->auth_state.stale) { if (rt->server_type == RTSP_SERVER_WMS || (rt->server_type != RTSP_SERVER_REAL && diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 246b7cfa1406c10219e9730aef0347cdc9b30869..89f7f99ecc366e815441b1b130b0a3f66a8b639d 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);