调用hi_mpi_vdec_get_frame接口成功,返回的解码结果为失败(frame_info->v_frame.frame_flag = 1),表示可能由于输入码流异常、设置的码流格式与实际码流不一致等问题导致解码失败。
常见语法解析日志报错示例如下:
pid 0 usr chn 0 device 0 chn 0, input stream error, can't decode, report to user
ppssps_check_tmp_id: pps is null with this pic_parameter_set_id = 1 haven't decode
PPS or SPS of this slice not valid
sliceheader dec err
H264DEC inquire_slice_property error
hevc_inquire_slice_property error
ref frame(poc 15) lost
SH hevc_dec_short_term_ref_pic_set error
p_temp_r_pset->num_negative_pics(66) out of range(0,15)
frame_flag = 1解码失败,一般是由于送给VDEC视频解码模板的输入码流存在异常,或者网络不稳定导致播包丢帧导致码流异常,所以解码会报错失败,针对这种情况,可以通过保存输入码流来进行判断输入码流是否异常。
ret = hi_mpi_vdec_send_stream(chn, stream, vdec_pic_info, milli_sec); if (ret == HI_SUCCESS) { FILE *fd = NULL; fd = fopen("input_stream", "a+"); fwrite(stream->addr, stream->len, 1, fd); fclose(fd); }
aclrtMemcpy(stream->addr, stream->len, buf, size, ACL_MEMCPY_HOST_TO_DEVICE); ret = hi_mpi_vdec_send_stream(chn, stream, vdec_pic_info, milli_sec); if (ret == HI_SUCCESS) { FILE *fd = NULL; fd = fopen("input_stream", "a+"); fwrite(buf, size, 1, fd); fclose(fd); }