修复首帧不是I帧 导致花屏的问题

This commit is contained in:
xiongziliang
2019-08-02 10:53:00 +08:00
parent 0980bde12d
commit 35c324b6b4
3 changed files with 11 additions and 4 deletions

View File

@@ -79,6 +79,14 @@ void MP4Muxer::onTrackFrame(const Frame::Ptr &frame) {
return;
}
if(frame->getTrackType() == TrackVideo){
if(!_started && !frame->keyFrame()){
//第一帧必须是I帧防止花屏
return;
}
_started = true;
}
int with_nalu_size ;
switch (frame->getCodecId()){
case CodecH264: