for h264 pps sps aud sei not check first_mb_in_slice

This commit is contained in:
xgj 2021-06-17 19:26:58 +08:00
parent 1920802764
commit 3429690d75
2 changed files with 3 additions and 2 deletions

View File

@ -191,7 +191,8 @@ bool FrameMerger::willFlush(const Frame::Ptr &frame) const{
}
switch (frame->getCodecId()) {
case CodecH264 : {
if (frame->data()[frame->prefixSize()+1]&0x80 !=0) {
auto type = H264_TYPE(frame->data()[frame->prefixSize()]);
if (frame->data()[frame->prefixSize()+1]&0x80 !=0 && type >=H264Frame::NAL_B_P && type<=H264Frame::NAL_IDR ) {// sei aud pps sps 不判断
//264 新一帧的开始,刷新输出
return true;
}else{

View File

@ -183,7 +183,7 @@ void H264RtmpEncoder::inputFrame(const Frame::Ptr &frame) {
}
}
if(_lastPacket && (_lastPacket->time_stamp != frame->dts() || pcData[1]&0x80 != 0)) {
if(_lastPacket && (_lastPacket->time_stamp != frame->dts() || (pcData[1]&0x80 != 0 && type>=H264Frame::NAL_B_P && type<=H264Frame::NAL_IDR))) {
RtmpCodec::inputRtmp(_lastPacket);
_lastPacket = nullptr;
}