1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: Set to alive when got any packet

This commit is contained in:
winlin 2020-09-19 11:04:54 +08:00
parent 8bf677e3c8
commit 7c682a99c9
3 changed files with 16 additions and 5 deletions

View file

@ -1912,8 +1912,6 @@ srs_error_t SrsRtcConnection::on_stun(SrsUdpMuxSocket* skt, SrsStunPacket* r)
return err;
}
last_stun_time = srs_get_system_time();
// We are running in the ice-lite(server) mode. If client have multi network interface,
// we only choose one candidate pair which is determined by client.
update_sendonly_socket(skt);
@ -2203,11 +2201,16 @@ srs_error_t SrsRtcConnection::start_publish(std::string stream_uri)
return err;
}
bool SrsRtcConnection::is_stun_timeout()
bool SrsRtcConnection::is_alive()
{
return last_stun_time + session_timeout < srs_get_system_time();
}
void SrsRtcConnection::alive()
{
last_stun_time = srs_get_system_time();
}
void SrsRtcConnection::update_sendonly_socket(SrsUdpMuxSocket* skt)
{
// TODO: FIXME: Refine performance.