@@ -398,7 +398,7 @@ static av_cold int initialize(AVFormatContext *s)
398
398
WHIPContext * whip = s -> priv_data ;
399
399
uint32_t seed ;
400
400
401
- whip -> whip_starttime = av_gettime ();
401
+ whip -> whip_starttime = av_gettime_relative ();
402
402
403
403
ret = certificate_key_init (s );
404
404
if (ret < 0 ) {
@@ -420,9 +420,9 @@ static av_cold int initialize(AVFormatContext *s)
420
420
421
421
if (whip -> state < WHIP_STATE_INIT )
422
422
whip -> state = WHIP_STATE_INIT ;
423
- whip -> whip_init_time = av_gettime ();
423
+ whip -> whip_init_time = av_gettime_relative ();
424
424
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 ()));
426
426
427
427
return 0 ;
428
428
}
@@ -752,7 +752,7 @@ static int generate_sdp_offer(AVFormatContext *s)
752
752
753
753
if (whip -> state < WHIP_STATE_OFFER )
754
754
whip -> state = WHIP_STATE_OFFER ;
755
- whip -> whip_offer_time = av_gettime ();
755
+ whip -> whip_offer_time = av_gettime_relative ();
756
756
av_log (whip , AV_LOG_VERBOSE , "Generated state=%d, offer: %s\n" , whip -> state , whip -> sdp_offer );
757
757
758
758
end :
@@ -978,10 +978,10 @@ static int parse_answer(AVFormatContext *s)
978
978
979
979
if (whip -> state < WHIP_STATE_NEGOTIATED )
980
980
whip -> state = WHIP_STATE_NEGOTIATED ;
981
- whip -> whip_answer_time = av_gettime ();
981
+ whip -> whip_answer_time = av_gettime_relative ();
982
982
av_log (whip , AV_LOG_VERBOSE , "SDP state=%d, offer=%zuB, answer=%zuB, ufrag=%s, pwd=%zuB, transport=%s://%s:%d, elapsed=%dms\n" ,
983
983
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 ()));
985
985
986
986
end :
987
987
avio_context_free (& pb );
@@ -1264,9 +1264,9 @@ static int udp_connect(AVFormatContext *s)
1264
1264
1265
1265
if (whip -> state < WHIP_STATE_UDP_CONNECTED )
1266
1266
whip -> state = WHIP_STATE_UDP_CONNECTED ;
1267
- whip -> whip_udp_time = av_gettime ();
1267
+ whip -> whip_udp_time = av_gettime_relative ();
1268
1268
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 );
1270
1270
1271
1271
end :
1272
1272
av_dict_free (& opts );
@@ -1276,7 +1276,7 @@ static int udp_connect(AVFormatContext *s)
1276
1276
static int handle_ice_handshake (AVFormatContext * s )
1277
1277
{
1278
1278
int ret = 0 , size , i ;
1279
- int64_t starttime = av_gettime (), now ;
1279
+ int64_t starttime = av_gettime_relative (), now ;
1280
1280
WHIPContext * whip = s -> priv_data ;
1281
1281
int is_dtls_active = whip -> flags & WHIP_FLAG_DTLS_ACTIVE ;
1282
1282
@@ -1304,7 +1304,7 @@ static int handle_ice_handshake(AVFormatContext *s)
1304
1304
}
1305
1305
1306
1306
next_packet :
1307
- now = av_gettime ();
1307
+ now = av_gettime_relative ();
1308
1308
if (now - starttime >= whip -> handshake_timeout * 1000 ) {
1309
1309
av_log (whip , AV_LOG_ERROR , "ICE handshake timeout=%dms, cost=%dms, elapsed=%dms, state=%d\n" ,
1310
1310
whip -> handshake_timeout , ELAPSED (starttime , now ), ELAPSED (whip -> whip_starttime , now ), whip -> state );
@@ -1331,7 +1331,7 @@ static int handle_ice_handshake(AVFormatContext *s)
1331
1331
if (ice_is_binding_response (whip -> buf , ret )) {
1332
1332
if (whip -> is_peer_ice_lite ) {
1333
1333
whip -> state = WHIP_STATE_ICE_CONNECTED ;
1334
- whip -> whip_ice_time = av_gettime ();
1334
+ whip -> whip_ice_time = av_gettime_relative ();
1335
1335
}
1336
1336
goto next_packet ;
1337
1337
}
@@ -1346,7 +1346,7 @@ static int handle_ice_handshake(AVFormatContext *s)
1346
1346
if (is_dtls_packet (whip -> buf , ret ) || whip -> flags & WHIP_FLAG_DTLS_ACTIVE ) {
1347
1347
if (whip -> state < WHIP_STATE_ICE_CONNECTED ) {
1348
1348
whip -> state = WHIP_STATE_ICE_CONNECTED ;
1349
- whip -> whip_ice_time = av_gettime ();
1349
+ whip -> whip_ice_time = av_gettime_relative ();
1350
1350
}
1351
1351
ret = 0 ;
1352
1352
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)
1397
1397
}
1398
1398
if (!ret ) {
1399
1399
whip -> state = WHIP_STATE_DTLS_FINISHED ;
1400
- whip -> whip_dtls_time = av_gettime ();
1400
+ whip -> whip_dtls_time = av_gettime_relative ();
1401
1401
av_log (whip , AV_LOG_VERBOSE , "DTLS handshake is done, elapsed=%dms\n" ,
1402
1402
ELAPSED (whip -> whip_starttime , whip -> whip_dtls_time ));
1403
1403
}
@@ -1494,9 +1494,9 @@ static int setup_srtp(AVFormatContext *s)
1494
1494
1495
1495
if (whip -> state < WHIP_STATE_SRTP_FINISHED )
1496
1496
whip -> state = WHIP_STATE_SRTP_FINISHED ;
1497
- whip -> whip_srtp_time = av_gettime ();
1497
+ whip -> whip_srtp_time = av_gettime_relative ();
1498
1498
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 ()));
1500
1500
1501
1501
end :
1502
1502
return ret ;
@@ -1747,7 +1747,7 @@ static int create_rtp_muxer(AVFormatContext *s)
1747
1747
whip -> state = WHIP_STATE_READY ;
1748
1748
av_log (whip , AV_LOG_INFO , "Muxer state=%d, buffer_size=%d, max_packet_size=%d, "
1749
1749
"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 ()),
1751
1751
ELAPSED (whip -> whip_starttime , whip -> whip_init_time ),
1752
1752
ELAPSED (whip -> whip_init_time , whip -> whip_offer_time ),
1753
1753
ELAPSED (whip -> whip_offer_time , whip -> whip_answer_time ),
0 commit comments