mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
bug fixed
This commit is contained in:
parent
d037acbf62
commit
45494c020b
@ -80,7 +80,7 @@ bool RtpProcess::inputRtp(bool is_udp, const Socket::Ptr &sock, const char *data
|
||||
if (!_sock) {
|
||||
//第一次运行本函数
|
||||
_sock = sock;
|
||||
_addr = *((struct sockaddr_storage *)addr);
|
||||
_addr.reset(new sockaddr_storage(*((sockaddr_storage *)addr)));
|
||||
emitOnPublish();
|
||||
}
|
||||
|
||||
@ -198,11 +198,17 @@ void RtpProcess::setOnDetach(const function<void()> &cb) {
|
||||
}
|
||||
|
||||
string RtpProcess::get_peer_ip() {
|
||||
return SockUtil::inet_ntoa((struct sockaddr *)&_addr);
|
||||
if (!_addr) {
|
||||
return "::";
|
||||
}
|
||||
return SockUtil::inet_ntoa((sockaddr *)_addr.get());
|
||||
}
|
||||
|
||||
uint16_t RtpProcess::get_peer_port() {
|
||||
return SockUtil::inet_port((struct sockaddr *)&_addr);
|
||||
if (!_addr) {
|
||||
return 0;
|
||||
}
|
||||
return SockUtil::inet_port((sockaddr *)_addr.get());
|
||||
}
|
||||
|
||||
string RtpProcess::get_local_ip() {
|
||||
|
@ -84,7 +84,7 @@ private:
|
||||
private:
|
||||
uint32_t _dts = 0;
|
||||
uint64_t _total_bytes = 0;
|
||||
struct sockaddr_storage _addr{0};
|
||||
std::unique_ptr<sockaddr_storage> _addr;
|
||||
toolkit::Socket::Ptr _sock;
|
||||
MediaInfo _media_info;
|
||||
toolkit::Ticker _last_frame_time;
|
||||
|
Loading…
Reference in New Issue
Block a user