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

RTC: Support address switch

This commit is contained in:
winlin 2020-07-21 11:10:20 +08:00
parent 38f935ead8
commit 5f88dc357e
3 changed files with 21 additions and 0 deletions

View file

@ -1938,15 +1938,27 @@ bool SrsRtcConnection::is_stun_timeout()
return last_stun_time + sessionStunTimeout < srs_get_system_time();
}
// TODO: FIXME: We should support multiple addresses, because client may use more than one addresses.
void SrsRtcConnection::update_sendonly_socket(SrsUdpMuxSocket* skt)
{
std::string old_peer_id;
if (sendonly_skt) {
srs_trace("session %s address changed, update %s -> %s",
id().c_str(), sendonly_skt->peer_id().c_str(), skt->peer_id().c_str());
old_peer_id = sendonly_skt->peer_id();
}
// Update the transport.
srs_freep(sendonly_skt);
sendonly_skt = skt->copy_sendonly();
// Update the sessions to handle packets from the new address.
server_->insert_into_id_sessions(sendonly_skt->peer_id().c_str(), this);
// Remove the old address.
if (!old_peer_id.empty()) {
server_->remove_id_sessions(old_peer_id);
}
}
void SrsRtcConnection::check_send_nacks(SrsRtpNackForReceiver* nack, uint32_t ssrc)