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
3c40f171
Commit
3c40f171
authored
Feb 07, 2018
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组播地址改成字符串
parent
5ed2ce40
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
16 行增加
和
12 行删除
+16
-12
src/Common/config.cpp
+2
-6
src/Rtsp/RtpBroadCaster.cpp
+13
-5
src/Rtsp/RtpBroadCaster.h
+1
-1
没有找到文件。
src/Common/config.cpp
查看文件 @
3c40f171
...
...
@@ -210,20 +210,16 @@ onceToken token([](){
namespace
MultiCast
{
#define MULTI_FIELD "multicast."
//组播分配起始地址
#define MULTI_ADDR_MIN (0xE00000FF + 10)
const
char
kAddrMin
[]
=
MULTI_FIELD
"addrMin"
;
//组播分配截止地址
#define MULTI_ADDR_MAX (0xEFFFFFFF)
const
char
kAddrMax
[]
=
MULTI_FIELD
"addrMax"
;
//组播TTL
#define MULTI_UDP_TTL 64
const
char
kUdpTTL
[]
=
MULTI_FIELD
"udpTTL"
;
onceToken
token
([](){
mINI
::
Instance
()[
kAddrMin
]
=
MULTI_ADDR_MIN
;
mINI
::
Instance
()[
kAddrMax
]
=
MULTI_ADDR_MAX
;
mINI
::
Instance
()[
kAddrMin
]
=
"239.0.0.0"
;
mINI
::
Instance
()[
kAddrMax
]
=
"239.255.255.255"
;
mINI
::
Instance
()[
kUdpTTL
]
=
MULTI_UDP_TTL
;
},
nullptr
);
...
...
src/Rtsp/RtpBroadCaster.cpp
查看文件 @
3c40f171
...
...
@@ -26,6 +26,7 @@
#include <list>
#include <type_traits>
#include <arpa/inet.h>
#include "RtpBroadCaster.h"
#include "Util/util.h"
#include "Network/sockutil.h"
...
...
@@ -36,12 +37,20 @@ using namespace std;
namespace
ZL
{
namespace
Rtsp
{
static
uint32_t
addressToInt
(
const
string
&
ip
){
struct
in_addr
addr
;
bzero
(
&
addr
,
sizeof
(
addr
));
inet_aton
(
ip
.
data
(),
&
addr
);
return
(
uint32_t
)
ntohl
((
uint32_t
&
)
addr
.
s_addr
);
}
std
::
shared_ptr
<
uint32_t
>
MultiCastAddressMaker
::
obtain
(
uint32_t
iTry
)
{
lock_guard
<
recursive_mutex
>
lck
(
m_mtx
);
static
uint32_t
addrMin
=
mINI
::
Instance
()[
Config
::
MultiCast
::
kAddrMin
].
as
<
uint32_t
>
();
static
uint32_t
addrMax
=
mINI
::
Instance
()[
Config
::
MultiCast
::
kAddrMax
].
as
<
uint32_t
>
();
if
(
m_iAddr
>
addrMax
){
static
uint32_t
addrMin
=
addressToInt
(
mINI
::
Instance
()[
Config
::
MultiCast
::
kAddrMin
]);
static
uint32_t
addrMax
=
addressToInt
(
mINI
::
Instance
()[
Config
::
MultiCast
::
kAddrMax
]);
if
(
m_iAddr
>
addrMax
||
m_iAddr
==
0
){
m_iAddr
=
addrMin
;
}
auto
iGotAddr
=
m_iAddr
++
;
...
...
@@ -56,8 +65,7 @@ std::shared_ptr<uint32_t> MultiCastAddressMaker::obtain(uint32_t iTry) {
}
m_setBadAddr
.
emplace
(
iGotAddr
);
std
::
shared_ptr
<
uint32_t
>
ret
(
new
uint32_t
(
iGotAddr
),[](
uint32_t
*
ptr
){
auto
val
=
*
ptr
;
MultiCastAddressMaker
::
Instance
().
release
(
val
);
MultiCastAddressMaker
::
Instance
().
release
(
*
ptr
);
delete
ptr
;
});
return
ret
;
...
...
src/Rtsp/RtpBroadCaster.h
查看文件 @
3c40f171
...
...
@@ -65,7 +65,7 @@ public:
private
:
MultiCastAddressMaker
(){};
void
release
(
uint32_t
iAddr
);
uint32_t
m_iAddr
=
mINI
::
Instance
()[
Config
::
MultiCast
::
kAddrMin
].
as
<
uint32_t
>
()
;
uint32_t
m_iAddr
=
0
;
recursive_mutex
m_mtx
;
unordered_set
<
uint32_t
>
m_setBadAddr
;
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论