添加安全冗余代码

This commit is contained in:
xiongziliang 2019-12-18 15:02:55 +08:00
parent 5f0bbb3f17
commit 73df1bb949

View File

@ -129,6 +129,10 @@ void MP4Muxer::addTrack(const Track::Ptr &track) {
WarnL << "不是AAC Track"; WarnL << "不是AAC Track";
return; return;
} }
if(!aac_track->ready()){
WarnL << "AAC Track未就绪";
return;
}
auto track_id = mov_writer_add_audio(_mov_writter.get(), auto track_id = mov_writer_add_audio(_mov_writter.get(),
MOV_OBJECT_AAC, MOV_OBJECT_AAC,
aac_track->getAudioChannel(), aac_track->getAudioChannel(),
@ -148,6 +152,10 @@ void MP4Muxer::addTrack(const Track::Ptr &track) {
WarnL << "不是H264 Track"; WarnL << "不是H264 Track";
return; return;
} }
if(!h264_track->ready()){
WarnL << "H264 Track未就绪";
return;
}
struct mpeg4_avc_t avc; struct mpeg4_avc_t avc;
string sps_pps = string("\x00\x00\x00\x01", 4) + h264_track->getSps() + string sps_pps = string("\x00\x00\x00\x01", 4) + h264_track->getSps() +
@ -181,6 +189,10 @@ void MP4Muxer::addTrack(const Track::Ptr &track) {
WarnL << "不是H265 Track"; WarnL << "不是H265 Track";
return; return;
} }
if(!h265_track->ready()){
WarnL << "H265 Track未就绪";
return;
}
struct mpeg4_hevc_t hevc; struct mpeg4_hevc_t hevc;
string vps_sps_pps = string("\x00\x00\x00\x01", 4) + h265_track->getVps() + string vps_sps_pps = string("\x00\x00\x00\x01", 4) + h265_track->getVps() +