Skip to content

Commit d9c22ef

Browse files
committed
avformat/whip: correct ice time
Signed-off-by: Jack Lau <jacklau1222@qq.com>
1 parent 0ff779f commit d9c22ef

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

libavformat/whip.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,10 @@ static int handle_ice_handshake(AVFormatContext *s)
13211321

13221322
/* Handle the ICE binding response. */
13231323
if (ice_is_binding_response(whip->buf, ret)) {
1324-
if (whip->is_peer_ice_lite)
1324+
if (whip->is_peer_ice_lite) {
13251325
whip->state = WHIP_STATE_ICE_CONNECTED;
1326+
whip->whip_ice_time = av_gettime();
1327+
}
13261328
goto next_packet;
13271329
}
13281330

@@ -1334,12 +1336,14 @@ static int handle_ice_handshake(AVFormatContext *s)
13341336
}
13351337

13361338
if (is_dtls_packet(whip->buf, ret) || whip->flags & WHIP_FLAG_DTLS_ACTIVE) {
1337-
whip->state = WHIP_STATE_ICE_CONNECTED;
1339+
if (whip->state < WHIP_STATE_ICE_CONNECTED) {
1340+
whip->state = WHIP_STATE_ICE_CONNECTED;
1341+
whip->whip_ice_time = av_gettime();
1342+
}
13381343
ret = 0;
1339-
whip->whip_ice_time = av_gettime();
13401344
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",
13411345
whip->state, whip->ice_host, whip->ice_port, whip->whip_resource_url ? whip->whip_resource_url : "",
1342-
whip->ice_ufrag_remote, whip->ice_ufrag_local, ret, ELAPSED(whip->whip_starttime, av_gettime()));
1346+
whip->ice_ufrag_remote, whip->ice_ufrag_local, ret, ELAPSED(whip->whip_starttime, whip->whip_ice_time));
13431347
break;
13441348
}
13451349
}

0 commit comments

Comments
 (0)