mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
rtmp转rtsp兼容无metedata的流
This commit is contained in:
parent
9cb704664b
commit
3284ab2464
@ -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,20 +66,17 @@ 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>(_rtmpDemuxer->getDuration()));
|
||||||
std::make_shared<TitleSdp>(
|
for (auto &track : _rtmpDemuxer->getTracks(false)){
|
||||||
_rtmpDemuxer->getDuration()));
|
_rtspMuxer->addTrack(track);
|
||||||
for (auto &track : _rtmpDemuxer->getTracks(false)){
|
_recorder->addTrack(track);
|
||||||
_rtspMuxer->addTrack(track);
|
track->addDelegate(_rtspMuxer);
|
||||||
_recorder->addTrack(track);
|
track->addDelegate(_recorder);
|
||||||
track->addDelegate(_rtspMuxer);
|
|
||||||
track->addDelegate(_recorder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RtmpMediaSource::onWrite(pkt,key_pos);
|
RtmpMediaSource::onWrite(pkt,key_pos);
|
||||||
|
Loading…
Reference in New Issue
Block a user