mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-12-02 00:12:33 +08:00
regist rtmp after all is ready
This commit is contained in:
parent
5eefeca430
commit
8db012775b
@ -112,6 +112,7 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
|
|||||||
if (!ok) {
|
if (!ok) {
|
||||||
throw std::runtime_error( StrPrinter << "Already publishing:" << m_strApp << "/" << m_strId << endl);
|
throw std::runtime_error( StrPrinter << "Already publishing:" << m_strApp << "/" << m_strId << endl);
|
||||||
}
|
}
|
||||||
|
m_bPublisherSrcRegisted = false;
|
||||||
m_pPublisherSrc.reset(new RtmpToRtspMediaSource(m_strApp,m_strId));
|
m_pPublisherSrc.reset(new RtmpToRtspMediaSource(m_strApp,m_strId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +245,6 @@ void RtmpSession::setMetaData(AMFDecoder &dec) {
|
|||||||
throw std::runtime_error("can only set metadata");
|
throw std::runtime_error("can only set metadata");
|
||||||
}
|
}
|
||||||
m_pPublisherSrc->onGetMetaData(dec.load<AMFValue>());
|
m_pPublisherSrc->onGetMetaData(dec.load<AMFValue>());
|
||||||
m_pPublisherSrc->regist();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RtmpSession::onProcessCmd(AMFDecoder &dec) {
|
void RtmpSession::onProcessCmd(AMFDecoder &dec) {
|
||||||
@ -284,6 +284,10 @@ void RtmpSession::onRtmpChunk(RtmpPacket &chunkData) {
|
|||||||
throw std::runtime_error("Not a rtmp publisher!");
|
throw std::runtime_error("Not a rtmp publisher!");
|
||||||
}
|
}
|
||||||
m_pPublisherSrc->onGetMedia(chunkData);
|
m_pPublisherSrc->onGetMedia(chunkData);
|
||||||
|
if(!m_bPublisherSrcRegisted && m_pPublisherSrc->ready()){
|
||||||
|
m_bPublisherSrcRegisted = true;
|
||||||
|
m_pPublisherSrc->regist();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -44,6 +44,7 @@ private:
|
|||||||
|
|
||||||
RingBuffer<RtmpPacket>::RingReader::Ptr m_pRingReader;
|
RingBuffer<RtmpPacket>::RingReader::Ptr m_pRingReader;
|
||||||
std::shared_ptr<RtmpMediaSource> m_pPublisherSrc;
|
std::shared_ptr<RtmpMediaSource> m_pPublisherSrc;
|
||||||
|
bool m_bPublisherSrcRegisted = false;
|
||||||
std::weak_ptr<RtmpMediaSource> m_pPlayerSrc;
|
std::weak_ptr<RtmpMediaSource> m_pPlayerSrc;
|
||||||
|
|
||||||
void onProcessCmd(AMFDecoder &dec);
|
void onProcessCmd(AMFDecoder &dec);
|
||||||
|
Loading…
Reference in New Issue
Block a user