mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复RtpProcess析构中抛异常导致崩溃的问题 (#2714)
WarnP(this) 时会调用get_peer_ip()接口,此接口可能抛异常; 析构中抛异常可导致程序直接退出。
This commit is contained in:
parent
73c8a5faf4
commit
00b3c5184a
@ -210,31 +210,27 @@ void RtpProcess::setOnDetach(function<void()> cb) {
|
||||
}
|
||||
|
||||
string RtpProcess::get_peer_ip() {
|
||||
if (!_addr) {
|
||||
try {
|
||||
return _addr ? SockUtil::inet_ntoa((sockaddr *)_addr.get()) : "::";
|
||||
} catch (std::exception &ex) {
|
||||
return "::";
|
||||
}
|
||||
return SockUtil::inet_ntoa((sockaddr *)_addr.get());
|
||||
}
|
||||
|
||||
uint16_t RtpProcess::get_peer_port() {
|
||||
if (!_addr) {
|
||||
try {
|
||||
return _addr ? SockUtil::inet_port((sockaddr *)_addr.get()) : 0;
|
||||
} catch (std::exception &ex) {
|
||||
return 0;
|
||||
}
|
||||
return SockUtil::inet_port((sockaddr *)_addr.get());
|
||||
}
|
||||
|
||||
string RtpProcess::get_local_ip() {
|
||||
if (_sock) {
|
||||
return _sock->get_local_ip();
|
||||
}
|
||||
return "::";
|
||||
return _sock ? _sock->get_local_ip() : "::";
|
||||
}
|
||||
|
||||
uint16_t RtpProcess::get_local_port() {
|
||||
if (_sock) {
|
||||
return _sock->get_local_port();
|
||||
}
|
||||
return 0;
|
||||
return _sock ? _sock->get_local_port() : 0;
|
||||
}
|
||||
|
||||
string RtpProcess::getIdentifier() const {
|
||||
@ -305,4 +301,4 @@ float RtpProcess::getLossRate(MediaSource &sender, TrackType type) {
|
||||
}
|
||||
|
||||
}//namespace mediakit
|
||||
#endif//defined(ENABLE_RTPPROXY)
|
||||
#endif//defined(ENABLE_RTPPROXY)
|
||||
|
Loading…
Reference in New Issue
Block a user