优化变量名

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

View File

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