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
97116e12
Commit
97116e12
authored
Jun 11, 2022
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善getOwnerPoller相关逻辑
parent
b6d3ec52
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
21 行增加
和
3 行删除
+21
-3
src/Common/MediaSource.cpp
+5
-3
src/Common/MediaSource.h
+1
-0
src/Player/PlayerProxy.cpp
+4
-0
src/Player/PlayerProxy.h
+1
-0
src/Rtmp/RtmpSession.cpp
+4
-0
src/Rtmp/RtmpSession.h
+1
-0
src/Rtsp/RtspSession.cpp
+4
-0
src/Rtsp/RtspSession.h
+1
-0
没有找到文件。
src/Common/MediaSource.cpp
查看文件 @
97116e12
...
...
@@ -64,6 +64,7 @@ MediaSource::MediaSource(const string &schema, const string &vhost, const string
_app
=
app
;
_stream_id
=
stream_id
;
_create_stamp
=
time
(
NULL
);
_default_poller
=
EventPollerPool
::
Instance
().
getPoller
();
}
MediaSource
::~
MediaSource
()
{
...
...
@@ -222,11 +223,12 @@ int MediaSource::getLossRate(mediakit::TrackType type) {
}
toolkit
::
EventPoller
::
Ptr
MediaSource
::
getOwnerPoller
()
{
toolkit
::
EventPoller
::
Ptr
ret
;
auto
listener
=
_listener
.
lock
();
if
(
!
listener
)
{
ret
urn
nullptr
;
if
(
listener
)
{
ret
=
listener
->
getOwnerPoller
(
*
this
)
;
}
return
listener
->
getOwnerPoller
(
*
this
)
;
return
ret
?
ret
:
_default_poller
;
}
void
MediaSource
::
onReaderChanged
(
int
size
)
{
...
...
src/Common/MediaSource.h
查看文件 @
97116e12
...
...
@@ -343,6 +343,7 @@ private:
std
::
string
_app
;
std
::
string
_stream_id
;
std
::
weak_ptr
<
MediaSourceEvent
>
_listener
;
toolkit
::
EventPoller
::
Ptr
_default_poller
;
//对象个数统计
toolkit
::
ObjectStatistic
<
MediaSource
>
_statistic
;
};
...
...
src/Player/PlayerProxy.cpp
查看文件 @
97116e12
...
...
@@ -185,6 +185,10 @@ std::shared_ptr<SockInfo> PlayerProxy::getOriginSock(MediaSource &sender) const
return
getSockInfo
();
}
toolkit
::
EventPoller
::
Ptr
PlayerProxy
::
getOwnerPoller
(
MediaSource
&
sender
)
{
return
getPoller
();
}
void
PlayerProxy
::
onPlaySuccess
()
{
GET_CONFIG
(
bool
,
reset_when_replay
,
General
::
kResetWhenRePlay
);
if
(
dynamic_pointer_cast
<
RtspMediaSource
>
(
_media_src
))
{
...
...
src/Player/PlayerProxy.h
查看文件 @
97116e12
...
...
@@ -59,6 +59,7 @@ private:
MediaOriginType
getOriginType
(
MediaSource
&
sender
)
const
override
;
std
::
string
getOriginUrl
(
MediaSource
&
sender
)
const
override
;
std
::
shared_ptr
<
toolkit
::
SockInfo
>
getOriginSock
(
MediaSource
&
sender
)
const
override
;
toolkit
::
EventPoller
::
Ptr
getOwnerPoller
(
MediaSource
&
sender
)
override
;
void
rePlay
(
const
std
::
string
&
strUrl
,
int
iFailedCnt
);
void
onPlaySuccess
();
...
...
src/Rtmp/RtmpSession.cpp
查看文件 @
97116e12
...
...
@@ -598,6 +598,10 @@ std::shared_ptr<SockInfo> RtmpSession::getOriginSock(MediaSource &sender) const
return
const_cast
<
RtmpSession
*>
(
this
)
->
shared_from_this
();
}
toolkit
::
EventPoller
::
Ptr
RtmpSession
::
getOwnerPoller
(
MediaSource
&
sender
)
{
return
getPoller
();
}
void
RtmpSession
::
setSocketFlags
(){
GET_CONFIG
(
int
,
merge_write_ms
,
General
::
kMergeWriteMS
);
if
(
merge_write_ms
>
0
)
{
...
...
src/Rtmp/RtmpSession.h
查看文件 @
97116e12
...
...
@@ -80,6 +80,7 @@ private:
std
::
string
getOriginUrl
(
MediaSource
&
sender
)
const
override
;
// 获取媒体源客户端相关信息
std
::
shared_ptr
<
SockInfo
>
getOriginSock
(
MediaSource
&
sender
)
const
override
;
toolkit
::
EventPoller
::
Ptr
getOwnerPoller
(
MediaSource
&
sender
)
override
;
void
setSocketFlags
();
std
::
string
getStreamId
(
const
std
::
string
&
str
);
...
...
src/Rtsp/RtspSession.cpp
查看文件 @
97116e12
...
...
@@ -1153,6 +1153,10 @@ std::shared_ptr<SockInfo> RtspSession::getOriginSock(MediaSource &sender) const
return
const_cast
<
RtspSession
*>
(
this
)
->
shared_from_this
();
}
toolkit
::
EventPoller
::
Ptr
RtspSession
::
getOwnerPoller
(
MediaSource
&
sender
)
{
return
getPoller
();
}
void
RtspSession
::
onBeforeRtpSorted
(
const
RtpPacket
::
Ptr
&
rtp
,
int
track_index
){
updateRtcpContext
(
rtp
);
}
...
...
src/Rtsp/RtspSession.h
查看文件 @
97116e12
...
...
@@ -91,6 +91,7 @@ protected:
std
::
string
getOriginUrl
(
MediaSource
&
sender
)
const
override
;
// 获取媒体源客户端相关信息
std
::
shared_ptr
<
SockInfo
>
getOriginSock
(
MediaSource
&
sender
)
const
override
;
toolkit
::
EventPoller
::
Ptr
getOwnerPoller
(
MediaSource
&
sender
)
override
;
/////TcpSession override////
ssize_t
send
(
toolkit
::
Buffer
::
Ptr
pkt
)
override
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论