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
eccb1a66
Commit
eccb1a66
authored
Oct 01, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/chatop2020/ZLMediaKit
parents
e26f9972
4132df89
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
45 行增加
和
2 行删除
+45
-2
server/FFmpegSource.cpp
+2
-1
server/WebHook.cpp
+12
-0
src/Common/config.cpp
+21
-0
src/Common/config.h
+2
-0
src/Record/Recorder.cpp
+8
-1
没有找到文件。
server/FFmpegSource.cpp
查看文件 @
eccb1a66
...
@@ -198,7 +198,8 @@ void FFmpegSource::startTimer(int timeout_ms) {
...
@@ -198,7 +198,8 @@ void FFmpegSource::startTimer(int timeout_ms) {
//同步查找流
//同步查找流
if
(
!
src
)
{
if
(
!
src
)
{
//流不在线,重新拉流
//流不在线,重新拉流
if
(
strongSelf
->
_replay_ticker
.
elapsedTime
()
>
10
*
1000
){
//@子悦,这里原先是10秒超时,实际发现10秒不够,我改成20秒了
if
(
strongSelf
->
_replay_ticker
.
elapsedTime
()
>
20
*
1000
){
//上次重试时间超过10秒,那么再重试FFmpeg拉流
//上次重试时间超过10秒,那么再重试FFmpeg拉流
strongSelf
->
_replay_ticker
.
resetTime
();
strongSelf
->
_replay_ticker
.
resetTime
();
strongSelf
->
play
(
strongSelf
->
_src_url
,
strongSelf
->
_dst_url
,
timeout_ms
,
[](
const
SockException
&
)
{});
strongSelf
->
play
(
strongSelf
->
_src_url
,
strongSelf
->
_dst_url
,
timeout_ms
,
[](
const
SockException
&
)
{});
...
...
server/WebHook.cpp
查看文件 @
eccb1a66
...
@@ -158,6 +158,8 @@ static void do_http_hook(const string &url,const ArgsType &body,const function<v
...
@@ -158,6 +158,8 @@ static void do_http_hook(const string &url,const ArgsType &body,const function<v
static
ArgsType
make_json
(
const
MediaInfo
&
args
){
static
ArgsType
make_json
(
const
MediaInfo
&
args
){
ArgsType
body
;
ArgsType
body
;
GET_CONFIG
(
string
,
mediaServerId
,
General
::
kMediaServerId
);
body
[
"mediaserverid"
]
=
mediaServerId
;
body
[
"schema"
]
=
args
.
_schema
;
body
[
"schema"
]
=
args
.
_schema
;
body
[
"vhost"
]
=
args
.
_vhost
;
body
[
"vhost"
]
=
args
.
_vhost
;
body
[
"app"
]
=
args
.
_app
;
body
[
"app"
]
=
args
.
_app
;
...
@@ -319,6 +321,8 @@ void installWebHook(){
...
@@ -319,6 +321,8 @@ void installWebHook(){
return
;
return
;
}
}
ArgsType
body
;
ArgsType
body
;
GET_CONFIG
(
string
,
mediaServerId
,
General
::
kMediaServerId
);
body
[
"mediaserverid"
]
=
mediaServerId
;
body
[
"regist"
]
=
bRegist
;
body
[
"regist"
]
=
bRegist
;
body
[
"schema"
]
=
sender
.
getSchema
();
body
[
"schema"
]
=
sender
.
getSchema
();
body
[
"vhost"
]
=
sender
.
getVhost
();
body
[
"vhost"
]
=
sender
.
getVhost
();
...
@@ -344,6 +348,8 @@ void installWebHook(){
...
@@ -344,6 +348,8 @@ void installWebHook(){
static
auto
getRecordInfo
=
[](
const
RecordInfo
&
info
)
{
static
auto
getRecordInfo
=
[](
const
RecordInfo
&
info
)
{
ArgsType
body
;
ArgsType
body
;
GET_CONFIG
(
string
,
mediaServerId
,
General
::
kMediaServerId
);
body
[
"mediaserverid"
]
=
mediaServerId
;
body
[
"start_time"
]
=
(
Json
::
UInt64
)
info
.
start_time
;
body
[
"start_time"
]
=
(
Json
::
UInt64
)
info
.
start_time
;
body
[
"file_size"
]
=
(
Json
::
UInt64
)
info
.
file_size
;
body
[
"file_size"
]
=
(
Json
::
UInt64
)
info
.
file_size
;
body
[
"time_len"
]
=
info
.
time_len
;
body
[
"time_len"
]
=
info
.
time_len
;
...
@@ -382,6 +388,8 @@ void installWebHook(){
...
@@ -382,6 +388,8 @@ void installWebHook(){
return
;
return
;
}
}
ArgsType
body
;
ArgsType
body
;
GET_CONFIG
(
string
,
mediaServerId
,
General
::
kMediaServerId
);
body
[
"mediaserverid"
]
=
mediaServerId
;
body
[
"ip"
]
=
sender
.
get_peer_ip
();
body
[
"ip"
]
=
sender
.
get_peer_ip
();
body
[
"port"
]
=
sender
.
get_peer_port
();
body
[
"port"
]
=
sender
.
get_peer_port
();
body
[
"id"
]
=
sender
.
getIdentifier
();
body
[
"id"
]
=
sender
.
getIdentifier
();
...
@@ -400,6 +408,8 @@ void installWebHook(){
...
@@ -400,6 +408,8 @@ void installWebHook(){
}
}
ArgsType
body
;
ArgsType
body
;
GET_CONFIG
(
string
,
mediaServerId
,
General
::
kMediaServerId
);
body
[
"mediaserverid"
]
=
mediaServerId
;
body
[
"schema"
]
=
sender
.
getSchema
();
body
[
"schema"
]
=
sender
.
getSchema
();
body
[
"vhost"
]
=
sender
.
getVhost
();
body
[
"vhost"
]
=
sender
.
getVhost
();
body
[
"app"
]
=
sender
.
getApp
();
body
[
"app"
]
=
sender
.
getApp
();
...
@@ -445,6 +455,8 @@ void installWebHook(){
...
@@ -445,6 +455,8 @@ void installWebHook(){
}
}
ArgsType
body
;
ArgsType
body
;
GET_CONFIG
(
string
,
mediaServerId
,
General
::
kMediaServerId
);
body
[
"mediaserverid"
]
=
mediaServerId
;
body
[
"ip"
]
=
sender
.
get_peer_ip
();
body
[
"ip"
]
=
sender
.
get_peer_ip
();
body
[
"port"
]
=
sender
.
get_peer_port
();
body
[
"port"
]
=
sender
.
get_peer_port
();
body
[
"id"
]
=
sender
.
getIdentifier
();
body
[
"id"
]
=
sender
.
getIdentifier
();
...
...
src/Common/config.cpp
查看文件 @
eccb1a66
...
@@ -18,6 +18,25 @@
...
@@ -18,6 +18,25 @@
using
namespace
toolkit
;
using
namespace
toolkit
;
namespace
mediakit
{
namespace
mediakit
{
string
generalGuid
()
{
srand
(
time
(
0
));
std
::
string
random_str
(
""
);
for
(
int
i
=
0
;
i
<
6
;
++
i
)
{
for
(
int
j
=
0
;
j
<
8
;
j
++
)
switch
(
rand
()
%
2
)
{
case
1
:
random_str
+=
(
'A'
+
rand
()
%
26
);
break
;
default
:
random_str
+=
(
'0'
+
rand
()
%
10
);
break
;
}
if
(
i
<
5
)
random_str
+=
"-"
;
}
return
random_str
;
}
bool
loadIniConfig
(
const
char
*
ini_path
){
bool
loadIniConfig
(
const
char
*
ini_path
){
string
ini
;
string
ini
;
...
@@ -58,6 +77,7 @@ const string kBroadcastHttpBeforeAccess = "kBroadcastHttpBeforeAccess";
...
@@ -58,6 +77,7 @@ const string kBroadcastHttpBeforeAccess = "kBroadcastHttpBeforeAccess";
//通用配置项目
//通用配置项目
namespace
General
{
namespace
General
{
#define GENERAL_FIELD "general."
#define GENERAL_FIELD "general."
const
string
kMediaServerId
=
GENERAL_FIELD
"mediaServerId"
;
const
string
kFlowThreshold
=
GENERAL_FIELD
"flowThreshold"
;
const
string
kFlowThreshold
=
GENERAL_FIELD
"flowThreshold"
;
const
string
kStreamNoneReaderDelayMS
=
GENERAL_FIELD
"streamNoneReaderDelayMS"
;
const
string
kStreamNoneReaderDelayMS
=
GENERAL_FIELD
"streamNoneReaderDelayMS"
;
const
string
kMaxStreamWaitTimeMS
=
GENERAL_FIELD
"maxStreamWaitMS"
;
const
string
kMaxStreamWaitTimeMS
=
GENERAL_FIELD
"maxStreamWaitMS"
;
...
@@ -80,6 +100,7 @@ onceToken token([](){
...
@@ -80,6 +100,7 @@ onceToken token([](){
mINI
::
Instance
()[
kPublishToMP4
]
=
0
;
mINI
::
Instance
()[
kPublishToMP4
]
=
0
;
mINI
::
Instance
()[
kMergeWriteMS
]
=
0
;
mINI
::
Instance
()[
kMergeWriteMS
]
=
0
;
mINI
::
Instance
()[
kModifyStamp
]
=
0
;
mINI
::
Instance
()[
kModifyStamp
]
=
0
;
mINI
::
Instance
()[
kMediaServerId
]
=
generalGuid
();
},
nullptr
);
},
nullptr
);
}
//namespace General
}
//namespace General
...
...
src/Common/config.h
查看文件 @
eccb1a66
...
@@ -154,6 +154,8 @@ extern const string kBroadcastReloadConfig;
...
@@ -154,6 +154,8 @@ extern const string kBroadcastReloadConfig;
////////////通用配置///////////
////////////通用配置///////////
namespace
General
{
namespace
General
{
//每个流媒体服务器的ID(GUID)
extern
const
string
kMediaServerId
;
//流量汇报事件流量阈值,单位KB,默认1MB
//流量汇报事件流量阈值,单位KB,默认1MB
extern
const
string
kFlowThreshold
;
extern
const
string
kFlowThreshold
;
//流无人观看并且超过若干时间后才触发kBroadcastStreamNoneReader事件
//流无人观看并且超过若干时间后才触发kBroadcastStreamNoneReader事件
...
...
src/Record/Recorder.cpp
查看文件 @
eccb1a66
...
@@ -46,8 +46,15 @@ string Recorder::getRecordPath(Recorder::type type, const string &vhost, const s
...
@@ -46,8 +46,15 @@ string Recorder::getRecordPath(Recorder::type type, const string &vhost, const s
}
}
//Here we use the customized file path.
//Here we use the customized file path.
if
(
!
customized_path
.
empty
())
{
if
(
!
customized_path
.
empty
())
{
mp4FilePath
=
customized_path
+
"/"
;
/*开始删除*/
// mp4FilePath = customized_path + "/";
/*删除结束*/
/*开始添加*/
//@子悦,你上次说这里为了安全不能跳出目录,但实际操作过程中因为存储挂载位置不由流媒体决定,为了方便保存到挂载存储上,我这边做成可以跳出自已目录,你看是否合适,或者有其他办法可以处理这事
return
customized_path
+
"/"
+
mp4FilePath
;
/*开始添加*/
}
}
return
File
::
absolutePath
(
mp4FilePath
,
recordPath
);
return
File
::
absolutePath
(
mp4FilePath
,
recordPath
);
}
}
default
:
default
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论