解决某些设备推流无法播放的问题

This commit is contained in:
xiongziliang 2018-10-09 16:39:35 +08:00
parent 5d7ed15355
commit dddc167fb0

View File

@ -94,18 +94,16 @@ public:
} }
} }
virtual void onGetMedia(const RtmpPacket::Ptr &pkt) { virtual void onGetMedia(const RtmpPacket::Ptr &pkt) {
if(!m_bRegisted){
lock_guard<recursive_mutex> lock(m_mtxMap); lock_guard<recursive_mutex> lock(m_mtxMap);
if (m_mapCfgFrame.size() != m_iCfgFrameSize && pkt->isCfgFrame()) { if (pkt->isCfgFrame()) {
m_mapCfgFrame.emplace(pkt->typeId, pkt); m_mapCfgFrame.emplace(pkt->typeId, pkt);
if( m_mapCfgFrame.size() == m_iCfgFrameSize && m_bAsyncRegist){ if(m_bAsyncRegist && !m_bRegisted && m_mapCfgFrame.size() == m_iCfgFrameSize){
m_bAsyncRegist = false; m_bAsyncRegist = false;
MediaSource::regist(); MediaSource::regist();
m_bRegisted = true; m_bRegisted = true;
} }
} }
}
m_pRing->write(pkt,pkt->isVideoKeyFrame()); m_pRing->write(pkt,pkt->isVideoKeyFrame());
} }