mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 20:27:34 +08:00
完善获取媒体读取器个数方法
This commit is contained in:
parent
0fa2452657
commit
3917b6451c
@ -1 +1 @@
|
||||
Subproject commit 8f656dfdff2d7c83583a609212716ae8db921fbf
|
||||
Subproject commit 079fae2798687300ff55cfd53b6f80010abe6b81
|
@ -54,10 +54,13 @@ public:
|
||||
//拖动进度条
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool close() {
|
||||
//通知其停止推流
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void onReaderChanged(const EventPoller::Ptr &poller,int size,bool add_flag){}
|
||||
};
|
||||
class MediaInfo
|
||||
{
|
||||
@ -166,6 +169,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual int readerCount() = 0;
|
||||
protected:
|
||||
void regist() ;
|
||||
bool unregist() ;
|
||||
|
@ -64,6 +64,10 @@ public:
|
||||
return _pRing;
|
||||
}
|
||||
|
||||
int readerCount() override {
|
||||
return _pRing->readerCount();
|
||||
}
|
||||
|
||||
const AMFValue &getMetaData() const {
|
||||
lock_guard<recursive_mutex> lock(_mtxMap);
|
||||
return _metadata;
|
||||
@ -87,7 +91,7 @@ public:
|
||||
_mapCfgFrame[pkt->typeId] = pkt;
|
||||
} else{
|
||||
if(!_bRegisted){
|
||||
MediaSource::regist();
|
||||
regist();
|
||||
_bRegisted = true;
|
||||
}
|
||||
_mapStamp[pkt->typeId] = pkt->timeStamp;
|
||||
|
@ -89,6 +89,10 @@ public:
|
||||
_rtspMuxer->setListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
int readerCount() override {
|
||||
return RtmpMediaSource::readerCount() + _rtspMuxer->readerCount();
|
||||
}
|
||||
private:
|
||||
RtmpDemuxer::Ptr _rtmpDemuxer;
|
||||
RtspMediaSourceMuxer::Ptr _rtspMuxer;
|
||||
|
@ -65,6 +65,11 @@ public:
|
||||
//获取媒体源的rtp环形缓冲
|
||||
return _pRing;
|
||||
}
|
||||
|
||||
int readerCount() override {
|
||||
return _pRing->readerCount();
|
||||
}
|
||||
|
||||
const string& getSdp() const {
|
||||
//获取该源的媒体描述信息
|
||||
return _strSdp;
|
||||
|
@ -716,7 +716,7 @@ bool RtspSession::handleReq_Play(const Parser &parser) {
|
||||
auto iStartTime = 1000 * atof(strStart.data());
|
||||
InfoL << "rtsp seekTo(ms):" << iStartTime;
|
||||
useBuf = !pMediaSrc->seekTo(iStartTime);
|
||||
}else if(pMediaSrc->getRing()->readerCount() == 0){
|
||||
}else if(pMediaSrc->readerCount() == 0){
|
||||
//第一个消费者
|
||||
pMediaSrc->seekTo(0);
|
||||
}
|
||||
|
@ -85,6 +85,9 @@ public:
|
||||
_rtmpMuxer->setListener(listener);
|
||||
}
|
||||
}
|
||||
int readerCount() override {
|
||||
return RtspMediaSource::readerCount() + _rtmpMuxer->readerCount();
|
||||
}
|
||||
private:
|
||||
RtspDemuxer::Ptr _rtspDemuxer;
|
||||
RtmpMediaSourceMuxer::Ptr _rtmpMuxer;
|
||||
|
Loading…
Reference in New Issue
Block a user