Commit 3284ab24 by xiongziliang

rtmp转rtsp兼容无metedata的流

parent 9cb70466
...@@ -56,6 +56,7 @@ public: ...@@ -56,6 +56,7 @@ public:
bool bEnableMp4 = false, bool bEnableMp4 = false,
int ringSize = 0):RtmpMediaSource(vhost, app, id,ringSize){ int ringSize = 0):RtmpMediaSource(vhost, app, id,ringSize){
_recorder = std::make_shared<MediaRecorder>(vhost, app, id, bEnableHls, bEnableMp4); _recorder = std::make_shared<MediaRecorder>(vhost, app, id, bEnableHls, bEnableMp4);
_rtmpDemuxer = std::make_shared<RtmpDemuxer>();
} }
virtual ~RtmpToRtspMediaSource(){} virtual ~RtmpToRtspMediaSource(){}
...@@ -65,14 +66,12 @@ public: ...@@ -65,14 +66,12 @@ public:
} }
void onWrite(const RtmpPacket::Ptr &pkt,bool key_pos) override { void onWrite(const RtmpPacket::Ptr &pkt,bool key_pos) override {
if(_rtmpDemuxer){
_rtmpDemuxer->inputRtmp(pkt); _rtmpDemuxer->inputRtmp(pkt);
if(!_rtspMuxer && _rtmpDemuxer->isInited(2000)){ if(!_rtspMuxer && _rtmpDemuxer->isInited(2000)){
_rtspMuxer = std::make_shared<RtspMediaSourceMuxer>(getVhost(), _rtspMuxer = std::make_shared<RtspMediaSourceMuxer>(getVhost(),
getApp(), getApp(),
getId(), getId(),
std::make_shared<TitleSdp>( std::make_shared<TitleSdp>(_rtmpDemuxer->getDuration()));
_rtmpDemuxer->getDuration()));
for (auto &track : _rtmpDemuxer->getTracks(false)){ for (auto &track : _rtmpDemuxer->getTracks(false)){
_rtspMuxer->addTrack(track); _rtspMuxer->addTrack(track);
_recorder->addTrack(track); _recorder->addTrack(track);
...@@ -80,7 +79,6 @@ public: ...@@ -80,7 +79,6 @@ public:
track->addDelegate(_recorder); track->addDelegate(_recorder);
} }
} }
}
RtmpMediaSource::onWrite(pkt,key_pos); RtmpMediaSource::onWrite(pkt,key_pos);
} }
private: private:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论