mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
完善代码
This commit is contained in:
parent
c25307a105
commit
070c2c46d7
@ -55,9 +55,8 @@ static bool getH265ConfigFrame(const RtmpPacket &thiz,string &frame) {
|
|||||||
if (mpeg4_hevc_decoder_configuration_record_load((uint8_t *) extra, bytes, &hevc) > 0) {
|
if (mpeg4_hevc_decoder_configuration_record_load((uint8_t *) extra, bytes, &hevc) > 0) {
|
||||||
uint8_t config[1024] = {0};
|
uint8_t config[1024] = {0};
|
||||||
int size = mpeg4_hevc_to_nalu(&hevc, config, sizeof(config));
|
int size = mpeg4_hevc_to_nalu(&hevc, config, sizeof(config));
|
||||||
if (size > 0) {
|
if (size > 4) {
|
||||||
DebugL << hexdump((char *) config, size);
|
frame.assign((char *) config + 4, size - 4);
|
||||||
frame.assign((char *) config, size);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +73,7 @@ bool H265RtmpDecoder::decodeRtmp(const RtmpPacket::Ptr &pkt) {
|
|||||||
onGetH265(config.data(), config.size(), pkt->timeStamp , pkt->timeStamp);
|
onGetH265(config.data(), config.size(), pkt->timeStamp , pkt->timeStamp);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
WarnL << "请开启MP4相关功能并使能\"ENABLE_MP4\",否则对H265-RTMP支持不完善"
|
WarnL << "请开启MP4相关功能并使能\"ENABLE_MP4\",否则对H265-RTMP支持不完善";
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -245,7 +244,7 @@ void H265RtmpEncoder::makeVideoConfigPkt() {
|
|||||||
rtmpPkt->typeId = MSG_VIDEO;
|
rtmpPkt->typeId = MSG_VIDEO;
|
||||||
RtmpCodec::inputRtmp(rtmpPkt, false);
|
RtmpCodec::inputRtmp(rtmpPkt, false);
|
||||||
#else
|
#else
|
||||||
WarnL << "请开启MP4相关功能并使能\"ENABLE_MP4\",否则对H265-RTMP支持不完善"
|
WarnL << "请开启MP4相关功能并使能\"ENABLE_MP4\",否则对H265-RTMP支持不完善";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ void MP4Demuxer::onVideoTrack(uint32_t track, uint8_t object, int width, int hei
|
|||||||
uint8_t config[1024] = {0};
|
uint8_t config[1024] = {0};
|
||||||
int size = mpeg4_avc_to_nalu(&avc, config, sizeof(config));
|
int size = mpeg4_avc_to_nalu(&avc, config, sizeof(config));
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
video->inputFrame(std::make_shared<H264FrameNoCacheAble>((char *)config, size, 0, 0));
|
video->inputFrame(std::make_shared<H264FrameNoCacheAble>((char *)config, size, 0, 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ void MP4Demuxer::onVideoTrack(uint32_t track, uint8_t object, int width, int hei
|
|||||||
uint8_t config[1024] = {0};
|
uint8_t config[1024] = {0};
|
||||||
int size = mpeg4_hevc_to_nalu(&hevc, config, sizeof(config));
|
int size = mpeg4_hevc_to_nalu(&hevc, config, sizeof(config));
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
video->inputFrame(std::make_shared<H265FrameNoCacheAble>((char *) config, size, 0, 0));
|
video->inputFrame(std::make_shared<H265FrameNoCacheAble>((char *) config, size, 0, 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user