for h264/h265 judge a frame start more safe(h264 is first_mb_in_slice h265 is first_slice_segment_in_pic_flag) and for h265 only idr is key frame

This commit is contained in:
xgj
2021-06-18 12:40:42 +08:00
parent 3429690d75
commit a6e9652da8
4 changed files with 12 additions and 8 deletions

View File

@@ -64,10 +64,11 @@ bool H265Frame::configFrame() const {
}
bool H265Frame::isKeyFrame(int type, const char *ptr) {
if (!ptr || type != NAL_IDR_W_RADL) {
return type >= NAL_BLA_W_LP && type <= NAL_RSV_IRAP_VCL23;
if(ptr){
return (((*((uint8_t *) ptr + 2)) >> 7) & 0x01) == 1 && (type == NAL_IDR_N_LP || type == NAL_IDR_W_RADL);
}
return (((*((uint8_t *) ptr + 2)) >> 7) & 0x01) == 1;
return false;
}
H265Frame::H265Frame(){