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

RTC: Pithy print the address change

This commit is contained in:
winlin 2020-07-27 12:28:15 +08:00
parent a035d312f9
commit 5f7d1e2c5b
4 changed files with 20 additions and 8 deletions

View file

@ -1580,6 +1580,7 @@ SrsRtcConnection::SrsRtcConnection(SrsRtcServer* s, SrsContextId context_id)
twcc_id_ = 0;
nn_simulate_player_nack_drop = 0;
pp_address_change = new SrsErrorPithyPrint();
}
SrsRtcConnection::~SrsRtcConnection()
@ -1597,6 +1598,8 @@ SrsRtcConnection::~SrsRtcConnection()
SrsUdpMuxSocket* addr = it->second;
srs_freep(addr);
}
srs_freep(pp_address_change);
}
SrsSdp* SrsRtcConnection::get_local_sdp()
@ -1934,14 +1937,6 @@ void SrsRtcConnection::update_sendonly_socket(SrsUdpMuxSocket* skt)
return;
}
// Detect address change.
if (prev_peer_id.empty()) {
srs_trace("RTC: session address init %s", peer_id.c_str());
} else {
srs_trace("RTC: session address changed, update %s -> %s, total %u", prev_peer_id.c_str(),
peer_id.c_str(), peer_addresses_.size());
}
// Find object from cache.
SrsUdpMuxSocket* addr_cache = NULL;
if (true) {
@ -1957,6 +1952,14 @@ void SrsRtcConnection::update_sendonly_socket(SrsUdpMuxSocket* skt)
server_->insert_into_id_sessions(peer_id, this);
}
// Detect address change.
if (prev_peer_id.empty()) {
srs_trace("RTC: session address init %s", peer_id.c_str());
} else if (pp_address_change->can_print(skt->get_peer_port())) {
srs_trace("RTC: session address changed, update %s -> %s, cached=%d, total=%u", prev_peer_id.c_str(),
peer_id.c_str(), (addr_cache? 1:0), peer_addresses_.size());
}
// Update the transport.
sendonly_skt = addr_cache;
}