diff --git a/src/Common/MediaSender.h b/src/Common/MediaSender.h deleted file mode 100644 index a4fe7e41..00000000 --- a/src/Common/MediaSender.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2016 xiongziliang <771730766@qq.com> - * - * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit). - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -#ifndef SRC_MEDIASENDER_H_ -#define SRC_MEDIASENDER_H_ - -#include "Thread/ThreadPool.h" -using namespace ZL::Thread; - -class MediaSender { -public: - static ThreadPool & sendThread() { - static ThreadPool pool(1,ThreadPool::PRIORITY_HIGHEST); - return pool; - } -private: - MediaSender(); - virtual ~MediaSender(); -}; - -#endif /* SRC_MEDIASENDER_H_ */ diff --git a/src/Rtmp/RtmpMediaSource.h b/src/Rtmp/RtmpMediaSource.h index d9d9db82..437aa33a 100644 --- a/src/Rtmp/RtmpMediaSource.h +++ b/src/Rtmp/RtmpMediaSource.h @@ -36,7 +36,6 @@ #include "Rtmp.h" #include "RtmpParser.h" #include "Common/config.h" -#include "Common/MediaSender.h" #include "Common/MediaSource.h" #include "Util/util.h" #include "Util/logger.h" @@ -61,8 +60,7 @@ public: RtmpMediaSource(const string &vhost,const string &strApp, const string &strId) : MediaSource(RTMP_SCHEMA,vhost,strApp,strId), - m_pRing(new RingBuffer()), - m_thPool( MediaSender::sendThread()) { + m_pRing(new RingBuffer()) { } virtual ~RtmpMediaSource() {} @@ -109,10 +107,7 @@ public: } } - auto _ring = m_pRing; - m_thPool.async([_ring,pkt]() { - _ring->write(pkt,pkt->isVideoKeyFrame()); - }); + m_pRing->write(pkt,pkt->isVideoKeyFrame()); } private: bool ready(){ @@ -124,7 +119,6 @@ protected: unordered_map m_mapCfgFrame; mutable recursive_mutex m_mtxMap; RingBuffer::Ptr m_pRing; //rtp环形缓冲 - ThreadPool &m_thPool; int m_iCfgFrameSize = -1; bool m_bAsyncRegist = false; bool m_bRegisted = false; diff --git a/src/Rtsp/RtspMediaSource.h b/src/Rtsp/RtspMediaSource.h index fc928181..f8939d04 100644 --- a/src/Rtsp/RtspMediaSource.h +++ b/src/Rtsp/RtspMediaSource.h @@ -34,7 +34,6 @@ #include #include "Rtsp.h" #include "Common/config.h" -#include "Common/MediaSender.h" #include "Common/MediaSource.h" #include "Util/logger.h" @@ -60,8 +59,7 @@ public: RtspMediaSource(const string &strVhost,const string &strApp, const string &strId) : MediaSource(RTSP_SCHEMA,strVhost,strApp,strId), - m_pRing(new RingBuffer()), - m_thPool(MediaSender::sendThread()) { + m_pRing(new RingBuffer()) { } virtual ~RtspMediaSource() {} @@ -95,16 +93,12 @@ public: trackRef.timeStamp = rtppt->timeStamp; trackRef.ssrc = rtppt->ssrc; trackRef.type = rtppt->type; - auto _outRing = m_pRing; - m_thPool.async([_outRing,rtppt,keyPos]() { - _outRing->write(rtppt,keyPos); - }); + m_pRing->write(rtppt,keyPos); } protected: unordered_map m_mapTracks; string m_strSdp; //媒体描述信息 RingType::Ptr m_pRing; //rtp环形缓冲 - ThreadPool &m_thPool; }; } /* namespace Rtsp */