@@ -398,7 +398,7 @@ static av_cold int initialize(AVFormatContext *s)
398398 WHIPContext * whip = s -> priv_data ;
399399 uint32_t seed ;
400400
401- whip -> whip_starttime = av_gettime ();
401+ whip -> whip_starttime = av_gettime_relative ();
402402
403403 ret = certificate_key_init (s );
404404 if (ret < 0 ) {
@@ -420,9 +420,9 @@ static av_cold int initialize(AVFormatContext *s)
420420
421421 if (whip -> state < WHIP_STATE_INIT )
422422 whip -> state = WHIP_STATE_INIT ;
423- whip -> whip_init_time = av_gettime ();
423+ whip -> whip_init_time = av_gettime_relative ();
424424 av_log (whip , AV_LOG_VERBOSE , "Init state=%d, handshake_timeout=%dms, pkt_size=%d, seed=%d, elapsed=%dms\n" ,
425- whip -> state , whip -> handshake_timeout , whip -> pkt_size , seed , ELAPSED (whip -> whip_starttime , av_gettime ()));
425+ whip -> state , whip -> handshake_timeout , whip -> pkt_size , seed , ELAPSED (whip -> whip_starttime , av_gettime_relative ()));
426426
427427 return 0 ;
428428}
@@ -752,7 +752,7 @@ static int generate_sdp_offer(AVFormatContext *s)
752752
753753 if (whip -> state < WHIP_STATE_OFFER )
754754 whip -> state = WHIP_STATE_OFFER ;
755- whip -> whip_offer_time = av_gettime ();
755+ whip -> whip_offer_time = av_gettime_relative ();
756756 av_log (whip , AV_LOG_VERBOSE , "Generated state=%d, offer: %s\n" , whip -> state , whip -> sdp_offer );
757757
758758end :
@@ -978,10 +978,10 @@ static int parse_answer(AVFormatContext *s)
978978
979979 if (whip -> state < WHIP_STATE_NEGOTIATED )
980980 whip -> state = WHIP_STATE_NEGOTIATED ;
981- whip -> whip_answer_time = av_gettime ();
981+ whip -> whip_answer_time = av_gettime_relative ();
982982 av_log (whip , AV_LOG_VERBOSE , "SDP state=%d, offer=%zuB, answer=%zuB, ufrag=%s, pwd=%zuB, transport=%s://%s:%d, elapsed=%dms\n" ,
983983 whip -> state , strlen (whip -> sdp_offer ), strlen (whip -> sdp_answer ), whip -> ice_ufrag_remote , strlen (whip -> ice_pwd_remote ),
984- whip -> ice_protocol , whip -> ice_host , whip -> ice_port , ELAPSED (whip -> whip_starttime , av_gettime ()));
984+ whip -> ice_protocol , whip -> ice_host , whip -> ice_port , ELAPSED (whip -> whip_starttime , av_gettime_relative ()));
985985
986986end :
987987 avio_context_free (& pb );
@@ -1264,9 +1264,9 @@ static int udp_connect(AVFormatContext *s)
12641264
12651265 if (whip -> state < WHIP_STATE_UDP_CONNECTED )
12661266 whip -> state = WHIP_STATE_UDP_CONNECTED ;
1267- whip -> whip_udp_time = av_gettime ();
1267+ whip -> whip_udp_time = av_gettime_relative ();
12681268 av_log (whip , AV_LOG_VERBOSE , "UDP state=%d, elapsed=%dms, connected to udp://%s:%d\n" ,
1269- whip -> state , ELAPSED (whip -> whip_starttime , av_gettime ()), whip -> ice_host , whip -> ice_port );
1269+ whip -> state , ELAPSED (whip -> whip_starttime , av_gettime_relative ()), whip -> ice_host , whip -> ice_port );
12701270
12711271end :
12721272 av_dict_free (& opts );
@@ -1276,7 +1276,7 @@ static int udp_connect(AVFormatContext *s)
12761276static int handle_ice_handshake (AVFormatContext * s )
12771277{
12781278 int ret = 0 , size , i ;
1279- int64_t starttime = av_gettime (), now ;
1279+ int64_t starttime = av_gettime_relative (), now ;
12801280 WHIPContext * whip = s -> priv_data ;
12811281 int is_dtls_active = whip -> flags & WHIP_FLAG_DTLS_ACTIVE ;
12821282
@@ -1304,7 +1304,7 @@ static int handle_ice_handshake(AVFormatContext *s)
13041304 }
13051305
13061306next_packet :
1307- now = av_gettime ();
1307+ now = av_gettime_relative ();
13081308 if (now - starttime >= whip -> handshake_timeout * 1000 ) {
13091309 av_log (whip , AV_LOG_ERROR , "ICE handshake timeout=%dms, cost=%dms, elapsed=%dms, state=%d\n" ,
13101310 whip -> handshake_timeout , ELAPSED (starttime , now ), ELAPSED (whip -> whip_starttime , now ), whip -> state );
@@ -1331,7 +1331,7 @@ static int handle_ice_handshake(AVFormatContext *s)
13311331 if (ice_is_binding_response (whip -> buf , ret )) {
13321332 if (whip -> is_peer_ice_lite ) {
13331333 whip -> state = WHIP_STATE_ICE_CONNECTED ;
1334- whip -> whip_ice_time = av_gettime ();
1334+ whip -> whip_ice_time = av_gettime_relative ();
13351335 }
13361336 goto next_packet ;
13371337 }
@@ -1346,7 +1346,7 @@ static int handle_ice_handshake(AVFormatContext *s)
13461346 if (is_dtls_packet (whip -> buf , ret ) || whip -> flags & WHIP_FLAG_DTLS_ACTIVE ) {
13471347 if (whip -> state < WHIP_STATE_ICE_CONNECTED ) {
13481348 whip -> state = WHIP_STATE_ICE_CONNECTED ;
1349- whip -> whip_ice_time = av_gettime ();
1349+ whip -> whip_ice_time = av_gettime_relative ();
13501350 }
13511351 ret = 0 ;
13521352 av_log (whip , AV_LOG_VERBOSE , "ICE STUN ok, state=%d, url=udp://%s:%d, location=%s, username=%s:%s, res=%dB, elapsed=%dms\n" ,
@@ -1397,7 +1397,7 @@ static int handle_dtls_handshake(AVFormatContext *s)
13971397 }
13981398 if (!ret ) {
13991399 whip -> state = WHIP_STATE_DTLS_FINISHED ;
1400- whip -> whip_dtls_time = av_gettime ();
1400+ whip -> whip_dtls_time = av_gettime_relative ();
14011401 av_log (whip , AV_LOG_VERBOSE , "DTLS handshake is done, elapsed=%dms\n" ,
14021402 ELAPSED (whip -> whip_starttime , whip -> whip_dtls_time ));
14031403 }
@@ -1494,9 +1494,9 @@ static int setup_srtp(AVFormatContext *s)
14941494
14951495 if (whip -> state < WHIP_STATE_SRTP_FINISHED )
14961496 whip -> state = WHIP_STATE_SRTP_FINISHED ;
1497- whip -> whip_srtp_time = av_gettime ();
1497+ whip -> whip_srtp_time = av_gettime_relative ();
14981498 av_log (whip , AV_LOG_VERBOSE , "SRTP setup done, state=%d, suite=%s, key=%zuB, elapsed=%dms\n" ,
1499- whip -> state , suite , sizeof (send_key ), ELAPSED (whip -> whip_starttime , av_gettime ()));
1499+ whip -> state , suite , sizeof (send_key ), ELAPSED (whip -> whip_starttime , av_gettime_relative ()));
15001500
15011501end :
15021502 return ret ;
@@ -1747,7 +1747,7 @@ static int create_rtp_muxer(AVFormatContext *s)
17471747 whip -> state = WHIP_STATE_READY ;
17481748 av_log (whip , AV_LOG_INFO , "Muxer state=%d, buffer_size=%d, max_packet_size=%d, "
17491749 "elapsed=%dms(init:%d,offer:%d,answer:%d,udp:%d,ice:%d,dtls:%d,srtp:%d)\n" ,
1750- whip -> state , buffer_size , max_packet_size , ELAPSED (whip -> whip_starttime , av_gettime ()),
1750+ whip -> state , buffer_size , max_packet_size , ELAPSED (whip -> whip_starttime , av_gettime_relative ()),
17511751 ELAPSED (whip -> whip_starttime , whip -> whip_init_time ),
17521752 ELAPSED (whip -> whip_init_time , whip -> whip_offer_time ),
17531753 ELAPSED (whip -> whip_offer_time , whip -> whip_answer_time ),
0 commit comments