Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
b09919d3
Commit
b09919d3
authored
Apr 23, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
替换inet_ntoa线程安全版本
parent
727322b8
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
11 行增加
和
10 行删除
+11
-10
3rdpart/ZLToolKit
+1
-1
src/Rtp/RtpProcess.cpp
+4
-3
src/Rtsp/RtpMultiCaster.cpp
+1
-1
src/Rtsp/RtpMultiCaster.h
+1
-1
src/Rtsp/RtspPlayer.cpp
+2
-2
src/Rtsp/RtspSession.cpp
+1
-1
src/Rtsp/UDPServer.cpp
+1
-1
没有找到文件。
ZLToolKit
@
f0608fb7
Subproject commit
987683f1045613098e2bcd534bc90a13d16df8a4
Subproject commit
f0608fb75660682150f45f857d5d8051880b13aa
src/Rtp/RtpProcess.cpp
查看文件 @
b09919d3
...
...
@@ -15,6 +15,7 @@
#include "Extension/H265.h"
#include "Extension/AAC.h"
#include "Extension/G711.h"
#define RTP_APP_NAME "rtp"
namespace
mediakit
{
...
...
@@ -57,7 +58,7 @@ string printSSRC(uint32_t ui32Ssrc) {
}
static
string
printAddress
(
const
struct
sockaddr
*
addr
){
return
StrPrinter
<<
inet_ntoa
(((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
)
<<
":"
<<
ntohs
(((
struct
sockaddr_in
*
)
addr
)
->
sin_port
);
return
StrPrinter
<<
SockUtil
::
inet_ntoa
(((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
)
<<
":"
<<
ntohs
(((
struct
sockaddr_in
*
)
addr
)
->
sin_port
);
}
RtpProcess
::
RtpProcess
(
uint32_t
ssrc
)
{
...
...
@@ -73,7 +74,7 @@ RtpProcess::RtpProcess(uint32_t ssrc) {
GET_CONFIG
(
bool
,
toHls
,
General
::
kPublishToHls
);
GET_CONFIG
(
bool
,
toMP4
,
General
::
kPublishToMP4
);
_muxer
=
std
::
make_shared
<
MultiMediaSourceMuxer
>
(
DEFAULT_VHOST
,
"rtp"
,
printSSRC
(
_ssrc
),
0
,
toRtxp
,
toRtxp
,
toHls
,
toMP4
);
_muxer
=
std
::
make_shared
<
MultiMediaSourceMuxer
>
(
DEFAULT_VHOST
,
RTP_APP_NAME
,
printSSRC
(
_ssrc
),
0
,
toRtxp
,
toRtxp
,
toHls
,
toMP4
);
GET_CONFIG
(
string
,
dump_dir
,
RtpProxy
::
kDumpDir
);
{
...
...
@@ -310,7 +311,7 @@ bool RtpProcess::alive() {
}
string
RtpProcess
::
get_peer_ip
()
{
return
inet_ntoa
(((
struct
sockaddr_in
*
)
_addr
)
->
sin_addr
);
return
SockUtil
::
inet_ntoa
(((
struct
sockaddr_in
*
)
_addr
)
->
sin_addr
);
}
uint16_t
RtpProcess
::
get_peer_port
()
{
...
...
src/Rtsp/RtpMultiCaster.cpp
查看文件 @
b09919d3
...
...
@@ -141,7 +141,7 @@ uint16_t RtpMultiCaster::getPort(TrackType trackType){
return
_apUdpSock
[
trackType
]
->
get_local_port
();
}
string
RtpMultiCaster
::
getIP
(){
return
inet_ntoa
(
_aPeerUdpAddr
[
0
].
sin_addr
);
return
SockUtil
::
inet_ntoa
(
_aPeerUdpAddr
[
0
].
sin_addr
);
}
RtpMultiCaster
::
Ptr
RtpMultiCaster
::
make
(
const
EventPoller
::
Ptr
&
poller
,
const
string
&
strLocalIp
,
const
string
&
strVhost
,
const
string
&
strApp
,
const
string
&
strStream
){
try
{
...
...
src/Rtsp/RtpMultiCaster.h
查看文件 @
b09919d3
...
...
@@ -38,7 +38,7 @@ public:
}
static
string
toString
(
uint32_t
iAddr
){
iAddr
=
htonl
(
iAddr
);
return
::
inet_ntoa
((
struct
in_addr
&
)(
iAddr
));
return
SockUtil
::
inet_ntoa
((
struct
in_addr
&
)(
iAddr
));
}
virtual
~
MultiCastAddressMaker
(){}
std
::
shared_ptr
<
uint32_t
>
obtain
(
uint32_t
iTry
=
10
);
...
...
src/Rtsp/RtspPlayer.cpp
查看文件 @
b09919d3
...
...
@@ -337,7 +337,7 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int uiTrackIndex)
return
;
}
if
(((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
.
s_addr
!=
srcIP
)
{
WarnL
<<
"收到其他地址的rtp数据:"
<<
inet_ntoa
(((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
);
WarnL
<<
"收到其他地址的rtp数据:"
<<
SockUtil
::
inet_ntoa
(((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
);
return
;
}
strongSelf
->
handleOneRtp
(
uiTrackIndex
,
strongSelf
->
_aTrackInfo
[
uiTrackIndex
],
(
unsigned
char
*
)
buf
->
data
(),
buf
->
size
());
...
...
@@ -351,7 +351,7 @@ void RtspPlayer::handleResSETUP(const Parser &parser, unsigned int uiTrackIndex)
return
;
}
if
(((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
.
s_addr
!=
srcIP
)
{
WarnL
<<
"收到其他地址的rtcp数据:"
<<
inet_ntoa
(((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
);
WarnL
<<
"收到其他地址的rtcp数据:"
<<
SockUtil
::
inet_ntoa
(((
struct
sockaddr_in
*
)
addr
)
->
sin_addr
);
return
;
}
strongSelf
->
onRtcpPacket
(
uiTrackIndex
,
strongSelf
->
_aTrackInfo
[
uiTrackIndex
],
(
unsigned
char
*
)
buf
->
data
(),
buf
->
size
());
...
...
src/Rtsp/RtspSession.cpp
查看文件 @
b09919d3
...
...
@@ -955,7 +955,7 @@ inline void RtspSession::startListenPeerUdpData(int trackIdx) {
if
(((
struct
sockaddr_in
*
)
pPeerAddr
)
->
sin_addr
.
s_addr
!=
srcIP
)
{
WarnP
(
strongSelf
.
get
())
<<
((
intervaled
%
2
==
0
)
?
"收到其他地址的rtp数据:"
:
"收到其他地址的rtcp数据:"
)
<<
inet_ntoa
(((
struct
sockaddr_in
*
)
pPeerAddr
)
->
sin_addr
);
<<
SockUtil
::
inet_ntoa
(((
struct
sockaddr_in
*
)
pPeerAddr
)
->
sin_addr
);
return
true
;
}
...
...
src/Rtsp/UDPServer.cpp
查看文件 @
b09919d3
...
...
@@ -76,7 +76,7 @@ void UDPServer::onErr(const string& strKey, const SockException& err) {
void
UDPServer
::
onRcvData
(
int
intervaled
,
const
Buffer
::
Ptr
&
pBuf
,
struct
sockaddr
*
pPeerAddr
)
{
//TraceL << trackIndex;
struct
sockaddr_in
*
in
=
(
struct
sockaddr_in
*
)
pPeerAddr
;
string
peerIp
=
inet_ntoa
(
in
->
sin_addr
);
string
peerIp
=
SockUtil
::
inet_ntoa
(
in
->
sin_addr
);
lock_guard
<
mutex
>
lck
(
_mtxDataHandler
);
auto
it0
=
_mapDataHandler
.
find
(
peerIp
);
if
(
it0
==
_mapDataHandler
.
end
())
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论