提高H264点播兼容性

This commit is contained in:
xiongziliang 2020-04-03 23:03:47 +08:00
parent 42eece5b9a
commit 1ca81e39fe
2 changed files with 4 additions and 4 deletions

View File

@ -257,7 +257,7 @@ public:
*/ */
void inputFrame(const Frame::Ptr &frame) override{ void inputFrame(const Frame::Ptr &frame) override{
int type = H264_TYPE(*((uint8_t *)frame->data() + frame->prefixSize())); int type = H264_TYPE(*((uint8_t *)frame->data() + frame->prefixSize()));
if(type == H264Frame::NAL_SPS){ if(type == H264Frame::NAL_SPS || type == H264Frame::NAL_SEI){
//有些设备会把SPS PPS IDR帧当做一个帧打包所以我们要split一下 //有些设备会把SPS PPS IDR帧当做一个帧打包所以我们要split一下
bool first_frame = true; bool first_frame = true;
splitH264(frame->data() + frame->prefixSize(), splitH264(frame->data() + frame->prefixSize(),

View File

@ -229,12 +229,12 @@ Frame::Ptr MP4Demuxer::makeFrame(uint32_t track_id, const Buffer::Ptr &buf, int6
iOffset += (iFrameLen + 4); iOffset += (iFrameLen + 4);
} }
if (codec == CodecH264) { if (codec == CodecH264) {
return std::make_shared<FrameWrapper<H264FrameNoCacheAble> >(buf, pts, dts,4); return std::make_shared<FrameWrapper<H264FrameNoCacheAble> >(buf, pts, dts, 4);
} }
return std::make_shared<FrameWrapper<H265FrameNoCacheAble> >(buf, pts, dts,4); return std::make_shared<FrameWrapper<H265FrameNoCacheAble> >(buf, pts, dts, 4);
} }
case CodecAAC : case CodecAAC :
return std::make_shared<FrameWrapper < AACFrameNoCacheAble> > (buf, pts, dts, 0); return std::make_shared<FrameWrapper<AACFrameNoCacheAble> >(buf, pts, dts, 0);
default: default:
return nullptr; return nullptr;
} }