优化变量名

This commit is contained in:
xiongziliang 2019-07-22 18:40:04 +08:00
parent cf4482983b
commit 91747947b9
2 changed files with 14 additions and 14 deletions

View File

@ -57,27 +57,27 @@ public:
int ringSize = 0) : RtmpMediaSource(vhost, app, id,ringSize){ int ringSize = 0) : RtmpMediaSource(vhost, app, id,ringSize){
_bEnableHls = bEnableHls; _bEnableHls = bEnableHls;
_bEnableMp4 = bEnableMp4; _bEnableMp4 = bEnableMp4;
_rtmpDemuxer = std::make_shared<RtmpDemuxer>(); _demuxer = std::make_shared<RtmpDemuxer>();
} }
virtual ~RtmpToRtspMediaSource(){} virtual ~RtmpToRtspMediaSource(){}
void onGetMetaData(const AMFValue &metadata) override { void onGetMetaData(const AMFValue &metadata) override {
_rtmpDemuxer = std::make_shared<RtmpDemuxer>(metadata); _demuxer = std::make_shared<RtmpDemuxer>(metadata);
RtmpMediaSource::onGetMetaData(metadata); RtmpMediaSource::onGetMetaData(metadata);
} }
void onWrite(const RtmpPacket::Ptr &pkt,bool key_pos) override { void onWrite(const RtmpPacket::Ptr &pkt,bool key_pos) override {
_rtmpDemuxer->inputRtmp(pkt); _demuxer->inputRtmp(pkt);
if(!_muxer && _rtmpDemuxer->isInited(2000)){ if(!_muxer && _demuxer->isInited(2000)){
_muxer = std::make_shared<MultiMediaSourceMuxer>(getVhost(), _muxer = std::make_shared<MultiMediaSourceMuxer>(getVhost(),
getApp(), getApp(),
getId(), getId(),
_rtmpDemuxer->getDuration(), _demuxer->getDuration(),
true,//转rtsp true,//转rtsp
false,//不重复生成rtmp false,//不重复生成rtmp
_bEnableHls, _bEnableHls,
_bEnableMp4); _bEnableMp4);
for (auto &track : _rtmpDemuxer->getTracks(false)){ for (auto &track : _demuxer->getTracks(false)){
_muxer->addTrack(track); _muxer->addTrack(track);
track->addDelegate(_muxer); track->addDelegate(_muxer);
} }
@ -97,7 +97,7 @@ public:
return RtmpMediaSource::readerCount() + (_muxer ? _muxer->readerCount() : 0); return RtmpMediaSource::readerCount() + (_muxer ? _muxer->readerCount() : 0);
} }
private: private:
RtmpDemuxer::Ptr _rtmpDemuxer; RtmpDemuxer::Ptr _demuxer;
MultiMediaSourceMuxer::Ptr _muxer; MultiMediaSourceMuxer::Ptr _muxer;
bool _bEnableHls; bool _bEnableHls;
bool _bEnableMp4; bool _bEnableMp4;

View File

@ -53,23 +53,23 @@ public:
virtual ~RtspToRtmpMediaSource() {} virtual ~RtspToRtmpMediaSource() {}
virtual void onGetSDP(const string &strSdp) override { virtual void onGetSDP(const string &strSdp) override {
_rtspDemuxer = std::make_shared<RtspDemuxer>(strSdp); _demuxer = std::make_shared<RtspDemuxer>(strSdp);
RtspMediaSource::onGetSDP(strSdp); RtspMediaSource::onGetSDP(strSdp);
} }
virtual void onWrite(const RtpPacket::Ptr &rtp, bool bKeyPos) override { virtual void onWrite(const RtpPacket::Ptr &rtp, bool bKeyPos) override {
if (_rtspDemuxer) { if (_demuxer) {
bKeyPos = _rtspDemuxer->inputRtp(rtp); bKeyPos = _demuxer->inputRtp(rtp);
if (!_muxer && _rtspDemuxer->isInited(2000)) { if (!_muxer && _demuxer->isInited(2000)) {
_muxer = std::make_shared<MultiMediaSourceMuxer>(getVhost(), _muxer = std::make_shared<MultiMediaSourceMuxer>(getVhost(),
getApp(), getApp(),
getId(), getId(),
_rtspDemuxer->getDuration(), _demuxer->getDuration(),
false,//不重复生成rtsp false,//不重复生成rtsp
true,//转rtmp true,//转rtmp
_bEnableHls, _bEnableHls,
_bEnableMp4); _bEnableMp4);
for (auto &track : _rtspDemuxer->getTracks(false)) { for (auto &track : _demuxer->getTracks(false)) {
_muxer->addTrack(track); _muxer->addTrack(track);
track->addDelegate(_muxer); track->addDelegate(_muxer);
} }
@ -89,7 +89,7 @@ public:
return RtspMediaSource::readerCount() + (_muxer ? _muxer->readerCount() : 0); return RtspMediaSource::readerCount() + (_muxer ? _muxer->readerCount() : 0);
} }
private: private:
RtspDemuxer::Ptr _rtspDemuxer; RtspDemuxer::Ptr _demuxer;
MultiMediaSourceMuxer::Ptr _muxer; MultiMediaSourceMuxer::Ptr _muxer;
bool _bEnableHls; bool _bEnableHls;
bool _bEnableMp4; bool _bEnableMp4;