mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
提高无Metadata的rtmp推流的兼容性
This commit is contained in:
parent
1fda56ab6e
commit
adfc084d4a
@ -45,9 +45,6 @@ RtmpDemuxer::RtmpDemuxer(const AMFValue &val) {
|
||||
}
|
||||
}
|
||||
|
||||
int RtmpDemuxer::getTrackCount(const AMFValue &metadata) {
|
||||
return (int)(metadata["videocodecid"].type() != AMF_NULL) + (int)(metadata["audiocodecid"].type() != AMF_NULL);
|
||||
}
|
||||
|
||||
bool RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) {
|
||||
switch (pkt->typeId) {
|
||||
|
@ -55,14 +55,6 @@ public:
|
||||
RtmpDemuxer(const AMFValue &val);
|
||||
virtual ~RtmpDemuxer(){};
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取rtmp track 数
|
||||
* @param metadata rtmp的metadata
|
||||
* @return
|
||||
*/
|
||||
static int getTrackCount(const AMFValue &metadata);
|
||||
|
||||
/**
|
||||
* 开始解复用
|
||||
* @param pkt rtmp包
|
||||
|
@ -53,16 +53,22 @@ public:
|
||||
const string &app,
|
||||
const string &id,
|
||||
int ringSize = 0) : RtmpMediaSource(vhost, app, id,ringSize){
|
||||
_demuxer = std::make_shared<RtmpDemuxer>();
|
||||
}
|
||||
virtual ~RtmpToRtspMediaSource(){}
|
||||
|
||||
void onGetMetaData(const AMFValue &metadata) override {
|
||||
_demuxer = std::make_shared<RtmpDemuxer>(metadata);
|
||||
if(!_demuxer){
|
||||
//在未调用onWrite前,设置Metadata能触发生成RtmpDemuxer
|
||||
_demuxer = std::make_shared<RtmpDemuxer>(metadata);
|
||||
}
|
||||
RtmpMediaSource::onGetMetaData(metadata);
|
||||
}
|
||||
|
||||
void onWrite(const RtmpPacket::Ptr &pkt,bool key_pos = true) override {
|
||||
if(!_demuxer){
|
||||
//尚未获取Metadata,那么不管有没有Metadata,都生成RtmpDemuxer
|
||||
_demuxer = std::make_shared<RtmpDemuxer>();
|
||||
}
|
||||
_demuxer->inputRtmp(pkt);
|
||||
if(!_muxer && _demuxer->isInited(2000)){
|
||||
_muxer = std::make_shared<MultiMediaSourceMuxer>(getVhost(),
|
||||
|
Loading…
Reference in New Issue
Block a user