mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-30 07:10:54 +08:00
优化多slice情况下关键帧判断逻辑
This commit is contained in:
parent
e00fe51b26
commit
9d385b36fd
@ -181,17 +181,15 @@ void H264Track::inputFrame_l(const Frame::Ptr &frame){
|
|||||||
_pps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
|
_pps = string(frame->data() + frame->prefixSize(), frame->size() - frame->prefixSize());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case H264Frame::NAL_IDR: {
|
|
||||||
insertConfigFrame(frame);
|
|
||||||
VideoTrack::inputFrame(frame);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case H264Frame::NAL_AUD: {
|
case H264Frame::NAL_AUD: {
|
||||||
//忽略AUD帧;
|
//忽略AUD帧;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (frame->keyFrame()) {
|
||||||
|
insertConfigFrame(frame);
|
||||||
|
}
|
||||||
VideoTrack::inputFrame(frame);
|
VideoTrack::inputFrame(frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -281,7 +279,8 @@ Sdp::Ptr H264Track::getSdp() {
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool H264Frame::keyFrame() const {
|
bool H264Frame::keyFrame() const {
|
||||||
return H264_TYPE(_buffer[_prefix_size]) == H264Frame::NAL_IDR;
|
//多slice 一帧的情况下检查 first_mb_in_slice 是否为0 表示其为一帧的开始
|
||||||
|
return H264_TYPE(_buffer[_prefix_size]) == H264Frame::NAL_IDR && (_buffer[_prefix_size + 1] & 0x80);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool H264Frame::configFrame() const {
|
bool H264Frame::configFrame() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user