添加踢出推流器功能

This commit is contained in:
xiongziliang
2018-02-06 10:56:58 +08:00
parent cf8b6f6b91
commit 4f072eb36a
6 changed files with 49 additions and 9 deletions

View File

@@ -145,7 +145,7 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
sendReply("onStatus", nullptr, status);
if (!ok) {
WarnL << "onPublish:"
<< (authSuccess ? "Already publishing:" : err.data())
<< (authSuccess ? "Already publishing:" : err.data()) << " "
<< m_mediaInfo.m_vhost << " "
<< m_mediaInfo.m_app << " "
<< m_mediaInfo.m_streamid << endl;
@@ -154,6 +154,7 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
}
m_bPublisherSrcRegisted = false;
m_pPublisherSrc.reset(new RtmpToRtspMediaSource(m_mediaInfo.m_vhost,m_mediaInfo.m_app,m_mediaInfo.m_streamid));
m_pPublisherSrc->setListener(dynamic_pointer_cast<MediaSourceEvent>(shared_from_this()));
};
weak_ptr<RtmpSession> weakSelf = dynamic_pointer_cast<RtmpSession>(shared_from_this());
@@ -213,7 +214,7 @@ void RtmpSession::doPlay(AMFDecoder &dec){
sendReply("onStatus", nullptr, status);
if (!ok) {
WarnL << "onPlayed:"
<< (authSuccess ? "No such stream:" : err.data())
<< (authSuccess ? "No such stream:" : err.data()) << " "
<< m_mediaInfo.m_vhost << " "
<< m_mediaInfo.m_app << " "
<< m_mediaInfo.m_streamid

View File

@@ -44,7 +44,7 @@ using namespace ZL::Network;
namespace ZL {
namespace Rtmp {
class RtmpSession: public TcpLimitedSession<MAX_TCP_SESSION> ,public RtmpProtocol{
class RtmpSession: public TcpLimitedSession<MAX_TCP_SESSION> ,public RtmpProtocol , public MediaSourceEvent{
public:
typedef std::shared_ptr<RtmpSession> Ptr;
RtmpSession(const std::shared_ptr<ThreadPool> &_th, const Socket::Ptr &_sock);
@@ -95,6 +95,12 @@ private:
invoke << str << m_dNowReqID << reply << status;
sendResponse(MSG_CMD, invoke.data());
}
bool shutDown() override {
InfoL << "kick out:" << m_mediaInfo.m_vhost << " " << m_mediaInfo.m_app << " " << m_mediaInfo.m_streamid;
safeShutdown();
return true;
}
};
} /* namespace Rtmp */