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
30984d20
Unverified
Commit
30984d20
authored
Aug 16, 2022
by
Dw9
Committed by
GitHub
Aug 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp4录制支持作为观看者参与播放人数统计 (#1880)
parent
c19fa29e
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
17 行增加
和
1 行删除
+17
-1
conf/config.ini
+2
-0
server/WebApi.cpp
+1
-0
server/WebHook.cpp
+3
-0
src/Common/MultiMediaSourceMuxer.cpp
+4
-1
src/Common/MultiMediaSourceMuxer.h
+3
-0
src/Common/config.cpp
+2
-0
src/Common/config.h
+2
-0
没有找到文件。
conf/config.ini
查看文件 @
30984d20
...
...
@@ -238,6 +238,8 @@ sampleMS=500
fastStart
=
0
#MP4点播(rtsp/rtmp/http-flv/ws-flv)是否循环播放文件
fileRepeat
=
0
#MP4录制是否当做播放器参与播放人数统计
mp4_as_player
=
0
[rtmp]
#rtmp必须在此时间内完成握手,否则服务器会断开链接,单位秒
...
...
server/WebApi.cpp
查看文件 @
30984d20
...
...
@@ -966,6 +966,7 @@ void installWebApi() {
ProtocolOption
option
;
getArgsValue
(
allArgs
,
"enable_hls"
,
option
.
enable_hls
);
getArgsValue
(
allArgs
,
"enable_mp4"
,
option
.
enable_mp4
);
getArgsValue
(
allArgs
,
"mp4_as_player"
,
option
.
mp4_as_player
);
getArgsValue
(
allArgs
,
"enable_rtsp"
,
option
.
enable_rtsp
);
getArgsValue
(
allArgs
,
"enable_rtmp"
,
option
.
enable_rtmp
);
getArgsValue
(
allArgs
,
"enable_ts"
,
option
.
enable_ts
);
...
...
server/WebHook.cpp
查看文件 @
30984d20
...
...
@@ -348,6 +348,9 @@ void installWebHook(){
if
(
obj
.
isMember
(
"continue_push_ms"
))
{
option
.
continue_push_ms
=
obj
[
"continue_push_ms"
].
asUInt
();
}
if
(
obj
.
isMember
(
"mp4_as_player"
))
{
option
.
mp4_as_player
=
obj
[
"mp4_as_player"
].
asBool
();
}
invoker
(
err
,
option
);
}
else
{
//推流鉴权失败
...
...
src/Common/MultiMediaSourceMuxer.cpp
查看文件 @
30984d20
...
...
@@ -26,14 +26,15 @@ ProtocolOption::ProtocolOption() {
GET_CONFIG
(
bool
,
s_to_mp4
,
General
::
kPublishToMP4
);
GET_CONFIG
(
bool
,
s_enabel_audio
,
General
::
kEnableAudio
);
GET_CONFIG
(
bool
,
s_add_mute_audio
,
General
::
kAddMuteAudio
);
GET_CONFIG
(
bool
,
s_mp4_as_player
,
Record
::
kMP4AsPlayer
);
GET_CONFIG
(
uint32_t
,
s_continue_push_ms
,
General
::
kContinuePushMS
);
enable_hls
=
s_to_hls
;
enable_mp4
=
s_to_mp4
;
enable_audio
=
s_enabel_audio
;
add_mute_audio
=
s_add_mute_audio
;
continue_push_ms
=
s_continue_push_ms
;
mp4_as_player
=
s_mp4_as_player
;
}
static
std
::
shared_ptr
<
MediaSinkInterface
>
makeRecorder
(
MediaSource
&
sender
,
const
vector
<
Track
::
Ptr
>
&
tracks
,
Recorder
::
type
type
,
const
string
&
custom_path
,
size_t
max_second
){
...
...
@@ -75,6 +76,7 @@ static string getTrackInfoStr(const TrackSource *track_src){
}
MultiMediaSourceMuxer
::
MultiMediaSourceMuxer
(
const
string
&
vhost
,
const
string
&
app
,
const
string
&
stream
,
float
dur_sec
,
const
ProtocolOption
&
option
)
{
_option
=
option
;
_get_origin_url
=
[
this
,
vhost
,
app
,
stream
]()
{
auto
ret
=
getOriginUrl
(
*
MediaSource
::
NullMediaSource
);
if
(
!
ret
.
empty
())
{
...
...
@@ -146,6 +148,7 @@ int MultiMediaSourceMuxer::totalReaderCount() const {
#if defined(ENABLE_MP4)
(
_fmp4
?
_fmp4
->
readerCount
()
:
0
)
+
#endif
(
_mp4
?
_option
.
mp4_as_player
:
0
)
+
(
hls
?
hls
->
readerCount
()
:
0
);
#if defined(ENABLE_RTPPROXY)
...
...
src/Common/MultiMediaSourceMuxer.h
查看文件 @
30984d20
...
...
@@ -31,6 +31,8 @@ public:
bool
enable_hls
=
false
;
//是否开启MP4录制
bool
enable_mp4
=
false
;
//是否将mp4录制当做观看者
bool
mp4_as_player
=
false
;
//是否开启转换为rtsp/webrtc
bool
enable_rtsp
=
true
;
//是否开启转换为rtmp/flv
...
...
@@ -175,6 +177,7 @@ protected:
private
:
bool
_is_enable
=
false
;
ProtocolOption
_option
;
toolkit
::
Ticker
_last_check
;
Stamp
_stamp
[
2
];
std
::
weak_ptr
<
Listener
>
_track_listener
;
...
...
src/Common/config.cpp
查看文件 @
30984d20
...
...
@@ -238,6 +238,7 @@ const string kFilePath = RECORD_FIELD "filePath";
const
string
kFileBufSize
=
RECORD_FIELD
"fileBufSize"
;
const
string
kFastStart
=
RECORD_FIELD
"fastStart"
;
const
string
kFileRepeat
=
RECORD_FIELD
"fileRepeat"
;
const
string
kMP4AsPlayer
=
RECORD_FIELD
"mp4_as_player"
;
static
onceToken
token
([]()
{
mINI
::
Instance
()[
kAppName
]
=
"record"
;
...
...
@@ -247,6 +248,7 @@ static onceToken token([]() {
mINI
::
Instance
()[
kFileBufSize
]
=
64
*
1024
;
mINI
::
Instance
()[
kFastStart
]
=
false
;
mINI
::
Instance
()[
kFileRepeat
]
=
false
;
mINI
::
Instance
()[
kMP4AsPlayer
]
=
false
;
});
}
// namespace Record
...
...
src/Common/config.h
查看文件 @
30984d20
...
...
@@ -295,6 +295,8 @@ extern const std::string kFileBufSize;
extern
const
std
::
string
kFastStart
;
// mp4文件是否重头循环读取
extern
const
std
::
string
kFileRepeat
;
//MP4录制是否当做播放器参与播放人数统计
extern
const
std
::
string
kMP4AsPlayer
;
}
// namespace Record
////////////HLS相关配置///////////
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论