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
9247cb95
Commit
9247cb95
authored
Apr 01, 2019
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持客户端自定义设置EventPoller对象,提高线程安全性
parent
6e2002e4
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
70 行增加
和
57 行删除
+70
-57
src/Player/MediaPlayer.cpp
+7
-7
src/Player/MediaPlayer.h
+3
-2
src/Player/PlayerBase.cpp
+4
-4
src/Player/PlayerBase.h
+5
-2
src/Player/PlayerProxy.cpp
+12
-14
src/Player/PlayerProxy.h
+2
-1
src/Pusher/MediaPusher.cpp
+11
-9
src/Pusher/MediaPusher.h
+5
-2
src/Pusher/PusherBase.cpp
+5
-4
src/Pusher/PusherBase.h
+6
-2
src/Rtmp/RtmpPlayer.cpp
+1
-1
src/Rtmp/RtmpPlayer.h
+1
-1
src/Rtmp/RtmpPlayerImp.h
+1
-1
src/Rtmp/RtmpPusher.cpp
+1
-1
src/Rtmp/RtmpPusher.h
+1
-1
src/Rtsp/RtspPlayer.cpp
+1
-1
src/Rtsp/RtspPlayer.h
+1
-1
src/Rtsp/RtspPlayerImp.h
+1
-1
src/Rtsp/RtspPusher.cpp
+1
-1
src/Rtsp/RtspPusher.h
+1
-1
没有找到文件。
src/Player/MediaPlayer.cpp
查看文件 @
9247cb95
...
@@ -32,13 +32,17 @@ using namespace toolkit;
...
@@ -32,13 +32,17 @@ using namespace toolkit;
namespace
mediakit
{
namespace
mediakit
{
MediaPlayer
::
MediaPlayer
()
{
MediaPlayer
::
MediaPlayer
(
const
EventPoller
::
Ptr
&
poller
)
{
_poller
=
poller
;
if
(
!
_poller
){
_poller
=
EventPollerPool
::
Instance
().
getPoller
();
}
}
}
MediaPlayer
::~
MediaPlayer
()
{
MediaPlayer
::~
MediaPlayer
()
{
}
}
void
MediaPlayer
::
play
(
const
string
&
strUrl
)
{
void
MediaPlayer
::
play
(
const
string
&
strUrl
)
{
_parser
=
PlayerBase
::
createPlayer
(
strUrl
);
_parser
=
PlayerBase
::
createPlayer
(
_poller
,
strUrl
);
_parser
->
setOnShutdown
(
_shutdownCB
);
_parser
->
setOnShutdown
(
_shutdownCB
);
_parser
->
setOnPlayResult
(
_playResultCB
);
_parser
->
setOnPlayResult
(
_playResultCB
);
_parser
->
setMediaSouce
(
_pMediaSrc
);
_parser
->
setMediaSouce
(
_pMediaSrc
);
...
@@ -47,11 +51,7 @@ void MediaPlayer::play(const string &strUrl) {
...
@@ -47,11 +51,7 @@ void MediaPlayer::play(const string &strUrl) {
}
}
EventPoller
::
Ptr
MediaPlayer
::
getPoller
(){
EventPoller
::
Ptr
MediaPlayer
::
getPoller
(){
auto
parser
=
dynamic_pointer_cast
<
SocketHelper
>
(
_parser
);
return
_poller
;
if
(
!
parser
){
return
nullptr
;
}
return
parser
->
getPoller
();
}
}
void
MediaPlayer
::
pause
(
bool
bPause
)
{
void
MediaPlayer
::
pause
(
bool
bPause
)
{
...
...
src/Player/MediaPlayer.h
查看文件 @
9247cb95
...
@@ -41,13 +41,14 @@ class MediaPlayer : public PlayerImp<PlayerBase,PlayerBase> {
...
@@ -41,13 +41,14 @@ class MediaPlayer : public PlayerImp<PlayerBase,PlayerBase> {
public
:
public
:
typedef
std
::
shared_ptr
<
MediaPlayer
>
Ptr
;
typedef
std
::
shared_ptr
<
MediaPlayer
>
Ptr
;
MediaPlayer
();
MediaPlayer
(
const
EventPoller
::
Ptr
&
poller
=
nullptr
);
virtual
~
MediaPlayer
();
virtual
~
MediaPlayer
();
void
play
(
const
string
&
strUrl
)
override
;
void
play
(
const
string
&
strUrl
)
override
;
void
pause
(
bool
bPause
)
override
;
void
pause
(
bool
bPause
)
override
;
void
teardown
()
override
;
void
teardown
()
override
;
EventPoller
::
Ptr
getPoller
();
EventPoller
::
Ptr
getPoller
();
private
:
EventPoller
::
Ptr
_poller
;
};
};
}
/* namespace mediakit */
}
/* namespace mediakit */
...
...
src/Player/PlayerBase.cpp
查看文件 @
9247cb95
...
@@ -33,7 +33,7 @@ using namespace toolkit;
...
@@ -33,7 +33,7 @@ using namespace toolkit;
namespace
mediakit
{
namespace
mediakit
{
PlayerBase
::
Ptr
PlayerBase
::
createPlayer
(
const
string
&
strUrl
)
{
PlayerBase
::
Ptr
PlayerBase
::
createPlayer
(
const
EventPoller
::
Ptr
&
poller
,
const
string
&
strUrl
)
{
static
auto
releasePlayer
=
[](
PlayerBase
*
ptr
){
static
auto
releasePlayer
=
[](
PlayerBase
*
ptr
){
onceToken
token
(
nullptr
,[
&
](){
onceToken
token
(
nullptr
,[
&
](){
delete
ptr
;
delete
ptr
;
...
@@ -42,12 +42,12 @@ PlayerBase::Ptr PlayerBase::createPlayer(const string &strUrl) {
...
@@ -42,12 +42,12 @@ PlayerBase::Ptr PlayerBase::createPlayer(const string &strUrl) {
};
};
string
prefix
=
FindField
(
strUrl
.
data
(),
NULL
,
"://"
);
string
prefix
=
FindField
(
strUrl
.
data
(),
NULL
,
"://"
);
if
(
strcasecmp
(
"rtsp"
,
prefix
.
data
())
==
0
)
{
if
(
strcasecmp
(
"rtsp"
,
prefix
.
data
())
==
0
)
{
return
PlayerBase
::
Ptr
(
new
RtspPlayerImp
(),
releasePlayer
);
return
PlayerBase
::
Ptr
(
new
RtspPlayerImp
(
poller
),
releasePlayer
);
}
}
if
(
strcasecmp
(
"rtmp"
,
prefix
.
data
())
==
0
)
{
if
(
strcasecmp
(
"rtmp"
,
prefix
.
data
())
==
0
)
{
return
PlayerBase
::
Ptr
(
new
RtmpPlayerImp
(),
releasePlayer
);
return
PlayerBase
::
Ptr
(
new
RtmpPlayerImp
(
poller
),
releasePlayer
);
}
}
return
PlayerBase
::
Ptr
(
new
RtspPlayerImp
(),
releasePlayer
);
return
PlayerBase
::
Ptr
(
new
RtspPlayerImp
(
poller
),
releasePlayer
);
}
}
PlayerBase
::
PlayerBase
()
{
PlayerBase
::
PlayerBase
()
{
...
...
src/Player/PlayerBase.h
查看文件 @
9247cb95
...
@@ -86,7 +86,7 @@ public:
...
@@ -86,7 +86,7 @@ public:
class
PlayerBase
:
public
DemuxerBase
,
public
mINI
{
class
PlayerBase
:
public
DemuxerBase
,
public
mINI
{
public
:
public
:
typedef
std
::
shared_ptr
<
PlayerBase
>
Ptr
;
typedef
std
::
shared_ptr
<
PlayerBase
>
Ptr
;
static
Ptr
createPlayer
(
const
string
&
strUrl
);
static
Ptr
createPlayer
(
const
EventPoller
::
Ptr
&
poller
,
const
string
&
strUrl
);
PlayerBase
();
PlayerBase
();
virtual
~
PlayerBase
(){}
virtual
~
PlayerBase
(){}
...
@@ -154,7 +154,10 @@ class PlayerImp : public Parent
...
@@ -154,7 +154,10 @@ class PlayerImp : public Parent
{
{
public
:
public
:
typedef
std
::
shared_ptr
<
PlayerImp
>
Ptr
;
typedef
std
::
shared_ptr
<
PlayerImp
>
Ptr
;
PlayerImp
(){}
template
<
typename
...
ArgsType
>
PlayerImp
(
ArgsType
&&
...
args
)
:
Parent
(
std
::
forward
<
ArgsType
>
(
args
)...){}
virtual
~
PlayerImp
(){}
virtual
~
PlayerImp
(){}
void
setOnShutdown
(
const
function
<
void
(
const
SockException
&
)
>
&
cb
)
override
{
void
setOnShutdown
(
const
function
<
void
(
const
SockException
&
)
>
&
cb
)
override
{
if
(
_parser
)
{
if
(
_parser
)
{
...
...
src/Player/PlayerProxy.cpp
查看文件 @
9247cb95
...
@@ -66,7 +66,8 @@ PlayerProxy::PlayerProxy(const string &strVhost,
...
@@ -66,7 +66,8 @@ PlayerProxy::PlayerProxy(const string &strVhost,
const
string
&
strSrc
,
const
string
&
strSrc
,
bool
bEnableHls
,
bool
bEnableHls
,
bool
bEnableMp4
,
bool
bEnableMp4
,
int
iRetryCount
){
int
iRetryCount
,
const
EventPoller
::
Ptr
&
poller
)
:
MediaPlayer
(
poller
){
_strVhost
=
strVhost
;
_strVhost
=
strVhost
;
_strApp
=
strApp
;
_strApp
=
strApp
;
_strSrc
=
strSrc
;
_strSrc
=
strSrc
;
...
@@ -127,21 +128,18 @@ void PlayerProxy::rePlay(const string &strUrl,int iFailedCnt){
...
@@ -127,21 +128,18 @@ void PlayerProxy::rePlay(const string &strUrl,int iFailedCnt){
WarnL
<<
"重试播放["
<<
iFailedCnt
<<
"]:"
<<
strUrl
;
WarnL
<<
"重试播放["
<<
iFailedCnt
<<
"]:"
<<
strUrl
;
strongPlayer
->
MediaPlayer
::
play
(
strUrl
);
strongPlayer
->
MediaPlayer
::
play
(
strUrl
);
return
false
;
return
false
;
},
nullptr
);
},
getPoller
()
);
}
}
bool
PlayerProxy
::
close
()
{
bool
PlayerProxy
::
close
()
{
//通知其停止推流
//通知其停止推流
weak_ptr
<
PlayerProxy
>
weakSlef
=
dynamic_pointer_cast
<
PlayerProxy
>
(
shared_from_this
());
weak_ptr
<
PlayerProxy
>
weakSlef
=
dynamic_pointer_cast
<
PlayerProxy
>
(
shared_from_this
());
auto
poller
=
getPoller
();
getPoller
()
->
async_first
([
weakSlef
]()
{
if
(
poller
)
{
auto
stronSelf
=
weakSlef
.
lock
();
poller
->
async_first
([
weakSlef
]()
{
if
(
stronSelf
)
{
auto
stronSelf
=
weakSlef
.
lock
();
stronSelf
->
_mediaMuxer
.
reset
();
if
(
stronSelf
)
{
stronSelf
->
teardown
();
stronSelf
->
_mediaMuxer
.
reset
();
}
stronSelf
->
teardown
();
});
}
});
}
return
true
;
return
true
;
}
}
...
...
src/Player/PlayerProxy.h
查看文件 @
9247cb95
...
@@ -51,7 +51,8 @@ public:
...
@@ -51,7 +51,8 @@ public:
const
string
&
strSrc
,
const
string
&
strSrc
,
bool
bEnableHls
=
true
,
bool
bEnableHls
=
true
,
bool
bEnableMp4
=
false
,
bool
bEnableMp4
=
false
,
int
iRetryCount
=
-
1
);
int
iRetryCount
=
-
1
,
const
EventPoller
::
Ptr
&
poller
=
nullptr
);
virtual
~
PlayerProxy
();
virtual
~
PlayerProxy
();
...
...
src/Pusher/MediaPusher.cpp
查看文件 @
9247cb95
...
@@ -32,21 +32,27 @@ using namespace toolkit;
...
@@ -32,21 +32,27 @@ using namespace toolkit;
namespace
mediakit
{
namespace
mediakit
{
MediaPusher
::
MediaPusher
(
const
MediaSource
::
Ptr
&
src
)
{
MediaPusher
::
MediaPusher
(
const
MediaSource
::
Ptr
&
src
,
const
EventPoller
::
Ptr
&
poller
)
{
_src
=
src
;
_src
=
src
;
_poller
=
poller
;
if
(
!
_poller
){
_poller
=
EventPollerPool
::
Instance
().
getPoller
();
}
}
}
MediaPusher
::
MediaPusher
(
const
string
&
schema
,
MediaPusher
::
MediaPusher
(
const
string
&
schema
,
const
string
&
strVhost
,
const
string
&
strVhost
,
const
string
&
strApp
,
const
string
&
strApp
,
const
string
&
strStream
)
{
const
string
&
strStream
,
_src
=
MediaSource
::
find
(
schema
,
strVhost
,
strApp
,
strStream
);
const
EventPoller
::
Ptr
&
poller
)
:
MediaPusher
(
MediaSource
::
find
(
schema
,
strVhost
,
strApp
,
strStream
),
poller
){
}
}
MediaPusher
::~
MediaPusher
()
{
MediaPusher
::~
MediaPusher
()
{
}
}
void
MediaPusher
::
publish
(
const
string
&
strUrl
)
{
void
MediaPusher
::
publish
(
const
string
&
strUrl
)
{
_parser
=
PusherBase
::
createPusher
(
_src
.
lock
(),
strUrl
);
_parser
=
PusherBase
::
createPusher
(
_
poller
,
_
src
.
lock
(),
strUrl
);
_parser
->
setOnShutdown
(
_shutdownCB
);
_parser
->
setOnShutdown
(
_shutdownCB
);
_parser
->
setOnPublished
(
_publishCB
);
_parser
->
setOnPublished
(
_publishCB
);
_parser
->
mINI
::
operator
=
(
*
this
);
_parser
->
mINI
::
operator
=
(
*
this
);
...
@@ -54,11 +60,7 @@ void MediaPusher::publish(const string &strUrl) {
...
@@ -54,11 +60,7 @@ void MediaPusher::publish(const string &strUrl) {
}
}
EventPoller
::
Ptr
MediaPusher
::
getPoller
(){
EventPoller
::
Ptr
MediaPusher
::
getPoller
(){
auto
parser
=
dynamic_pointer_cast
<
SocketHelper
>
(
_parser
);
return
_poller
;
if
(
!
parser
){
return
nullptr
;
}
return
parser
->
getPoller
();
}
}
...
...
src/Pusher/MediaPusher.h
查看文件 @
9247cb95
...
@@ -42,15 +42,18 @@ public:
...
@@ -42,15 +42,18 @@ public:
MediaPusher
(
const
string
&
schema
,
MediaPusher
(
const
string
&
schema
,
const
string
&
strVhost
,
const
string
&
strVhost
,
const
string
&
strApp
,
const
string
&
strApp
,
const
string
&
strStream
);
const
string
&
strStream
,
const
EventPoller
::
Ptr
&
poller
=
nullptr
);
MediaPusher
(
const
MediaSource
::
Ptr
&
src
);
MediaPusher
(
const
MediaSource
::
Ptr
&
src
,
const
EventPoller
::
Ptr
&
poller
=
nullptr
);
virtual
~
MediaPusher
();
virtual
~
MediaPusher
();
void
publish
(
const
string
&
strUrl
)
override
;
void
publish
(
const
string
&
strUrl
)
override
;
EventPoller
::
Ptr
getPoller
();
EventPoller
::
Ptr
getPoller
();
private
:
private
:
std
::
weak_ptr
<
MediaSource
>
_src
;
std
::
weak_ptr
<
MediaSource
>
_src
;
EventPoller
::
Ptr
_poller
;
};
};
}
/* namespace mediakit */
}
/* namespace mediakit */
...
...
src/Pusher/PusherBase.cpp
查看文件 @
9247cb95
...
@@ -35,7 +35,8 @@ using namespace mediakit::Client;
...
@@ -35,7 +35,8 @@ using namespace mediakit::Client;
namespace
mediakit
{
namespace
mediakit
{
PusherBase
::
Ptr
PusherBase
::
createPusher
(
const
MediaSource
::
Ptr
&
src
,
PusherBase
::
Ptr
PusherBase
::
createPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
MediaSource
::
Ptr
&
src
,
const
string
&
strUrl
)
{
const
string
&
strUrl
)
{
static
auto
releasePusher
=
[](
PusherBase
*
ptr
){
static
auto
releasePusher
=
[](
PusherBase
*
ptr
){
onceToken
token
(
nullptr
,[
&
](){
onceToken
token
(
nullptr
,[
&
](){
...
@@ -45,12 +46,12 @@ PusherBase::Ptr PusherBase::createPusher(const MediaSource::Ptr &src,
...
@@ -45,12 +46,12 @@ PusherBase::Ptr PusherBase::createPusher(const MediaSource::Ptr &src,
};
};
string
prefix
=
FindField
(
strUrl
.
data
(),
NULL
,
"://"
);
string
prefix
=
FindField
(
strUrl
.
data
(),
NULL
,
"://"
);
if
(
strcasecmp
(
"rtsp"
,
prefix
.
data
())
==
0
)
{
if
(
strcasecmp
(
"rtsp"
,
prefix
.
data
())
==
0
)
{
return
PusherBase
::
Ptr
(
new
RtspPusher
(
dynamic_pointer_cast
<
RtspMediaSource
>
(
src
)),
releasePusher
);
return
PusherBase
::
Ptr
(
new
RtspPusher
(
poller
,
dynamic_pointer_cast
<
RtspMediaSource
>
(
src
)),
releasePusher
);
}
}
if
(
strcasecmp
(
"rtmp"
,
prefix
.
data
())
==
0
)
{
if
(
strcasecmp
(
"rtmp"
,
prefix
.
data
())
==
0
)
{
return
PusherBase
::
Ptr
(
new
RtmpPusher
(
dynamic_pointer_cast
<
RtmpMediaSource
>
(
src
)),
releasePusher
);
return
PusherBase
::
Ptr
(
new
RtmpPusher
(
poller
,
dynamic_pointer_cast
<
RtmpMediaSource
>
(
src
)),
releasePusher
);
}
}
return
PusherBase
::
Ptr
(
new
RtspPusher
(
dynamic_pointer_cast
<
RtspMediaSource
>
(
src
)),
releasePusher
);
return
PusherBase
::
Ptr
(
new
RtspPusher
(
poller
,
dynamic_pointer_cast
<
RtspMediaSource
>
(
src
)),
releasePusher
);
}
}
PusherBase
::
PusherBase
()
{
PusherBase
::
PusherBase
()
{
...
...
src/Pusher/PusherBase.h
查看文件 @
9247cb95
...
@@ -44,7 +44,8 @@ public:
...
@@ -44,7 +44,8 @@ public:
typedef
std
::
shared_ptr
<
PusherBase
>
Ptr
;
typedef
std
::
shared_ptr
<
PusherBase
>
Ptr
;
typedef
std
::
function
<
void
(
const
SockException
&
ex
)
>
Event
;
typedef
std
::
function
<
void
(
const
SockException
&
ex
)
>
Event
;
static
Ptr
createPusher
(
const
MediaSource
::
Ptr
&
src
,
static
Ptr
createPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
MediaSource
::
Ptr
&
src
,
const
string
&
strUrl
);
const
string
&
strUrl
);
PusherBase
();
PusherBase
();
...
@@ -78,7 +79,10 @@ template<typename Parent,typename Parser>
...
@@ -78,7 +79,10 @@ template<typename Parent,typename Parser>
class
PusherImp
:
public
Parent
{
class
PusherImp
:
public
Parent
{
public
:
public
:
typedef
std
::
shared_ptr
<
PusherImp
>
Ptr
;
typedef
std
::
shared_ptr
<
PusherImp
>
Ptr
;
PusherImp
(){}
template
<
typename
...
ArgsType
>
PusherImp
(
ArgsType
&&
...
args
)
:
Parent
(
std
::
forward
<
ArgsType
>
(
args
)...){}
virtual
~
PusherImp
(){}
virtual
~
PusherImp
(){}
/**
/**
...
...
src/Rtmp/RtmpPlayer.cpp
查看文件 @
9247cb95
...
@@ -36,7 +36,7 @@ using namespace mediakit::Client;
...
@@ -36,7 +36,7 @@ using namespace mediakit::Client;
namespace
mediakit
{
namespace
mediakit
{
unordered_map
<
string
,
RtmpPlayer
::
rtmpCMDHandle
>
RtmpPlayer
::
g_mapCmd
;
unordered_map
<
string
,
RtmpPlayer
::
rtmpCMDHandle
>
RtmpPlayer
::
g_mapCmd
;
RtmpPlayer
::
RtmpPlayer
()
{
RtmpPlayer
::
RtmpPlayer
(
const
EventPoller
::
Ptr
&
poller
)
:
TcpClient
(
poller
)
{
static
onceToken
token
([]()
{
static
onceToken
token
([]()
{
g_mapCmd
.
emplace
(
"_error"
,
&
RtmpPlayer
::
onCmd_result
);
g_mapCmd
.
emplace
(
"_error"
,
&
RtmpPlayer
::
onCmd_result
);
g_mapCmd
.
emplace
(
"_result"
,
&
RtmpPlayer
::
onCmd_result
);
g_mapCmd
.
emplace
(
"_result"
,
&
RtmpPlayer
::
onCmd_result
);
...
...
src/Rtmp/RtmpPlayer.h
查看文件 @
9247cb95
...
@@ -48,7 +48,7 @@ namespace mediakit {
...
@@ -48,7 +48,7 @@ namespace mediakit {
class
RtmpPlayer
:
public
PlayerBase
,
public
TcpClient
,
public
RtmpProtocol
{
class
RtmpPlayer
:
public
PlayerBase
,
public
TcpClient
,
public
RtmpProtocol
{
public
:
public
:
typedef
std
::
shared_ptr
<
RtmpPlayer
>
Ptr
;
typedef
std
::
shared_ptr
<
RtmpPlayer
>
Ptr
;
RtmpPlayer
();
RtmpPlayer
(
const
EventPoller
::
Ptr
&
poller
);
virtual
~
RtmpPlayer
();
virtual
~
RtmpPlayer
();
void
play
(
const
string
&
strUrl
)
override
;
void
play
(
const
string
&
strUrl
)
override
;
...
...
src/Rtmp/RtmpPlayerImp.h
查看文件 @
9247cb95
...
@@ -43,7 +43,7 @@ namespace mediakit {
...
@@ -43,7 +43,7 @@ namespace mediakit {
class
RtmpPlayerImp
:
public
PlayerImp
<
RtmpPlayer
,
RtmpDemuxer
>
{
class
RtmpPlayerImp
:
public
PlayerImp
<
RtmpPlayer
,
RtmpDemuxer
>
{
public
:
public
:
typedef
std
::
shared_ptr
<
RtmpPlayerImp
>
Ptr
;
typedef
std
::
shared_ptr
<
RtmpPlayerImp
>
Ptr
;
RtmpPlayerImp
(){};
RtmpPlayerImp
(
const
EventPoller
::
Ptr
&
poller
)
:
PlayerImp
<
RtmpPlayer
,
RtmpDemuxer
>
(
poller
){};
virtual
~
RtmpPlayerImp
(){
virtual
~
RtmpPlayerImp
(){
DebugL
<<
endl
;
DebugL
<<
endl
;
};
};
...
...
src/Rtmp/RtmpPusher.cpp
查看文件 @
9247cb95
...
@@ -36,7 +36,7 @@ namespace mediakit {
...
@@ -36,7 +36,7 @@ namespace mediakit {
static
int
kSockFlags
=
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
;
static
int
kSockFlags
=
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
;
RtmpPusher
::
RtmpPusher
(
const
RtmpMediaSource
::
Ptr
&
src
){
RtmpPusher
::
RtmpPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
RtmpMediaSource
::
Ptr
&
src
)
:
TcpClient
(
poller
){
_pMediaSrc
=
src
;
_pMediaSrc
=
src
;
}
}
...
...
src/Rtmp/RtmpPusher.h
查看文件 @
9247cb95
...
@@ -37,7 +37,7 @@ namespace mediakit {
...
@@ -37,7 +37,7 @@ namespace mediakit {
class
RtmpPusher
:
public
RtmpProtocol
,
public
TcpClient
,
public
PusherBase
{
class
RtmpPusher
:
public
RtmpProtocol
,
public
TcpClient
,
public
PusherBase
{
public
:
public
:
typedef
std
::
shared_ptr
<
RtmpPusher
>
Ptr
;
typedef
std
::
shared_ptr
<
RtmpPusher
>
Ptr
;
RtmpPusher
(
const
RtmpMediaSource
::
Ptr
&
src
);
RtmpPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
RtmpMediaSource
::
Ptr
&
src
);
virtual
~
RtmpPusher
();
virtual
~
RtmpPusher
();
void
publish
(
const
string
&
strUrl
)
override
;
void
publish
(
const
string
&
strUrl
)
override
;
...
...
src/Rtsp/RtspPlayer.cpp
查看文件 @
9247cb95
...
@@ -43,7 +43,7 @@ using namespace mediakit::Client;
...
@@ -43,7 +43,7 @@ using namespace mediakit::Client;
namespace
mediakit
{
namespace
mediakit
{
RtspPlayer
::
RtspPlayer
(
void
){
RtspPlayer
::
RtspPlayer
(
const
EventPoller
::
Ptr
&
poller
)
:
TcpClient
(
poller
){
RtpReceiver
::
setPoolSize
(
64
);
RtpReceiver
::
setPoolSize
(
64
);
}
}
RtspPlayer
::~
RtspPlayer
(
void
)
{
RtspPlayer
::~
RtspPlayer
(
void
)
{
...
...
src/Rtsp/RtspPlayer.h
查看文件 @
9247cb95
...
@@ -52,7 +52,7 @@ class RtspPlayer: public PlayerBase,public TcpClient, public RtspSplitter, publi
...
@@ -52,7 +52,7 @@ class RtspPlayer: public PlayerBase,public TcpClient, public RtspSplitter, publi
public
:
public
:
typedef
std
::
shared_ptr
<
RtspPlayer
>
Ptr
;
typedef
std
::
shared_ptr
<
RtspPlayer
>
Ptr
;
RtspPlayer
(
)
;
RtspPlayer
(
const
EventPoller
::
Ptr
&
poller
)
;
virtual
~
RtspPlayer
(
void
);
virtual
~
RtspPlayer
(
void
);
void
play
(
const
string
&
strUrl
)
override
;
void
play
(
const
string
&
strUrl
)
override
;
void
pause
(
bool
bPause
)
override
;
void
pause
(
bool
bPause
)
override
;
...
...
src/Rtsp/RtspPlayerImp.h
查看文件 @
9247cb95
...
@@ -44,7 +44,7 @@ namespace mediakit {
...
@@ -44,7 +44,7 @@ namespace mediakit {
class
RtspPlayerImp
:
public
PlayerImp
<
RtspPlayer
,
RtspDemuxer
>
{
class
RtspPlayerImp
:
public
PlayerImp
<
RtspPlayer
,
RtspDemuxer
>
{
public
:
public
:
typedef
std
::
shared_ptr
<
RtspPlayerImp
>
Ptr
;
typedef
std
::
shared_ptr
<
RtspPlayerImp
>
Ptr
;
RtspPlayerImp
(
){};
RtspPlayerImp
(
const
EventPoller
::
Ptr
&
poller
)
:
PlayerImp
<
RtspPlayer
,
RtspDemuxer
>
(
poller
){}
virtual
~
RtspPlayerImp
(){
virtual
~
RtspPlayerImp
(){
DebugL
<<
endl
;
DebugL
<<
endl
;
};
};
...
...
src/Rtsp/RtspPusher.cpp
查看文件 @
9247cb95
...
@@ -13,7 +13,7 @@ namespace mediakit {
...
@@ -13,7 +13,7 @@ namespace mediakit {
static
int
kSockFlags
=
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
;
static
int
kSockFlags
=
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
;
RtspPusher
::
RtspPusher
(
const
RtspMediaSource
::
Ptr
&
src
)
{
RtspPusher
::
RtspPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
RtspMediaSource
::
Ptr
&
src
)
:
TcpClient
(
poller
)
{
_pMediaSrc
=
src
;
_pMediaSrc
=
src
;
}
}
...
...
src/Rtsp/RtspPusher.h
查看文件 @
9247cb95
...
@@ -25,7 +25,7 @@ namespace mediakit {
...
@@ -25,7 +25,7 @@ namespace mediakit {
class
RtspPusher
:
public
TcpClient
,
public
RtspSplitter
,
public
PusherBase
{
class
RtspPusher
:
public
TcpClient
,
public
RtspSplitter
,
public
PusherBase
{
public
:
public
:
typedef
std
::
shared_ptr
<
RtspPusher
>
Ptr
;
typedef
std
::
shared_ptr
<
RtspPusher
>
Ptr
;
RtspPusher
(
const
RtspMediaSource
::
Ptr
&
src
);
RtspPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
RtspMediaSource
::
Ptr
&
src
);
virtual
~
RtspPusher
();
virtual
~
RtspPusher
();
void
publish
(
const
string
&
strUrl
)
override
;
void
publish
(
const
string
&
strUrl
)
override
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论