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
e72fa359
Commit
e72fa359
authored
Dec 28, 2019
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善hls播放器个数计数
parent
f93b3274
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
15 行增加
和
4 行删除
+15
-4
api/include/mk_events_objects.h
+2
-0
api/source/mk_events_objects.cpp
+7
-0
server/WebApi.cpp
+2
-0
src/Rtmp/RtmpMediaSource.h
+1
-1
src/Rtmp/RtmpSession.cpp
+1
-1
src/Rtsp/RtspMediaSource.h
+1
-1
src/Rtsp/RtspSession.cpp
+1
-1
没有找到文件。
api/include/mk_events_objects.h
查看文件 @
e72fa359
...
...
@@ -109,6 +109,8 @@ API_EXPORT const char* API_CALL mk_media_source_get_app(const mk_media_source ct
API_EXPORT
const
char
*
API_CALL
mk_media_source_get_stream
(
const
mk_media_source
ctx
);
//MediaSource::readerCount()
API_EXPORT
int
API_CALL
mk_media_source_get_reader_count
(
const
mk_media_source
ctx
);
//MediaSource::totalReaderCount()
API_EXPORT
int
API_CALL
mk_media_source_get_total_reader_count
(
const
mk_media_source
ctx
);
//MediaSource::close()
API_EXPORT
int
API_CALL
mk_media_source_close
(
const
mk_media_source
ctx
,
int
force
);
//MediaSource::seekTo()
...
...
api/source/mk_events_objects.cpp
查看文件 @
e72fa359
...
...
@@ -199,6 +199,13 @@ API_EXPORT int API_CALL mk_media_source_get_reader_count(const mk_media_source c
MediaSource
*
src
=
(
MediaSource
*
)
ctx
;
return
src
->
readerCount
();
}
API_EXPORT
int
API_CALL
mk_media_source_get_total_reader_count
(
const
mk_media_source
ctx
){
assert
(
ctx
);
MediaSource
*
src
=
(
MediaSource
*
)
ctx
;
return
src
->
totalReaderCount
();
}
API_EXPORT
int
API_CALL
mk_media_source_close
(
const
mk_media_source
ctx
,
int
force
){
assert
(
ctx
);
MediaSource
*
src
=
(
MediaSource
*
)
ctx
;
...
...
server/WebApi.cpp
查看文件 @
e72fa359
...
...
@@ -412,6 +412,7 @@ void installWebApi() {
item
[
"app"
]
=
media
->
getApp
();
item
[
"stream"
]
=
media
->
getId
();
item
[
"readerCount"
]
=
media
->
readerCount
();
item
[
"totalReaderCount"
]
=
media
->
totalReaderCount
();
for
(
auto
&
track
:
media
->
getTracks
()){
Value
obj
;
obj
[
"codec_id"
]
=
track
->
getCodecId
();
...
...
@@ -441,6 +442,7 @@ void installWebApi() {
}
val
[
"online"
]
=
true
;
val
[
"readerCount"
]
=
src
->
readerCount
();
val
[
"totalReaderCount"
]
=
src
->
totalReaderCount
();
for
(
auto
&
track
:
src
->
getTracks
()){
Value
obj
;
obj
[
"codec_id"
]
=
track
->
getCodecId
();
...
...
src/Rtmp/RtmpMediaSource.h
查看文件 @
e72fa359
...
...
@@ -175,7 +175,7 @@ private:
void
onReaderChanged
(
int
size
)
{
//我们记录最后一次活动时间
_reader_changed_ticker
.
resetTime
();
if
(
size
!=
0
||
r
eaderCount
()
!=
0
)
{
if
(
size
!=
0
||
totalR
eaderCount
()
!=
0
)
{
//还有消费者正在观看该流
_async_emit_none_reader
=
false
;
return
;
...
...
src/Rtmp/RtmpSession.cpp
查看文件 @
e72fa359
...
...
@@ -302,7 +302,7 @@ void RtmpSession::sendPlayResponse(const string &err,const RtmpMediaSource::Ptr
strongSelf
->
shutdown
(
SockException
(
Err_shutdown
,
"rtmp ring buffer detached"
));
});
_pPlayerSrc
=
src
;
if
(
src
->
r
eaderCount
()
==
1
)
{
if
(
src
->
totalR
eaderCount
()
==
1
)
{
src
->
seekTo
(
0
);
}
//提高服务器发送性能
...
...
src/Rtsp/RtspMediaSource.h
查看文件 @
e72fa359
...
...
@@ -195,7 +195,7 @@ private:
void
onReaderChanged
(
int
size
)
{
//我们记录最后一次活动时间
_reader_changed_ticker
.
resetTime
();
if
(
size
!=
0
||
r
eaderCount
()
!=
0
)
{
if
(
size
!=
0
||
totalR
eaderCount
()
!=
0
)
{
//还有消费者正在观看该流
_async_emit_none_reader
=
false
;
return
;
...
...
src/Rtsp/RtspSession.cpp
查看文件 @
e72fa359
...
...
@@ -773,7 +773,7 @@ void RtspSession::handleReq_Play(const Parser &parser) {
auto
iStartTime
=
1000
*
atof
(
strStart
.
data
());
InfoP
(
this
)
<<
"rtsp seekTo(ms):"
<<
iStartTime
;
useBuf
=
!
pMediaSrc
->
seekTo
(
iStartTime
);
}
else
if
(
pMediaSrc
->
r
eaderCount
()
==
0
){
}
else
if
(
pMediaSrc
->
totalR
eaderCount
()
==
0
){
//第一个消费者
pMediaSrc
->
seekTo
(
0
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论