rockchip-linux / mpp

Media Process Platform (MPP) module
582 stars 169 forks source link

Linux 平台下 H264 编码错误:mpp encode put frame failed #87

Open BEIWG opened 5 years ago

BEIWG commented 5 years ago

在Linux 平台下进行H264 硬编码,调用mpp函数流程如下: mpp_frame_set_width(frame, mpp_enc_data.width); mpp_frame_set_height(frame, mpp_enc_data.height); mpp_frame_set_hor_stride(frame, mpp_enc_data.hor_stride); mpp_frame_set_ver_stride(frame, mpp_enc_data.ver_stride); mpp_frame_set_fmt(frame, mpp_enc_data.fmt); mpp_frame_set_buffer(frame, mpp_enc_data.frm_buf); mpp_frame_set_eos(frame, mpp_enc_data.frm_eos);

ret = mpp_enc_data.mpi->encode_put_frame(mpp_enc_data.ctx, frame);
if (ret)
{
    printf("mpp encode put frame failed\n");
    mpp_frame_deinit(&frame);
    return -1;
}

ret = mpp_enc_data.mpi->encode_get_packet(mpp_enc_data.ctx, &packet);
if (ret)
{
    printf("mpp encode get packet failed\n");
    mpp_frame_deinit(&frame);
    mpp_packet_deinit(&packet);
    return -1;
}

其中函数encode_put_frame()返回错误: mpp: put_frame poll on set timeout 0 ret -1 mpp encode put frame failed mpp: put_frame poll on set timeout 0 ret -1 mpp encode put frame failed mpp: put_frame poll on set timeout 0 ret -1 mpp encode put frame failed mpp: put_frame poll on set timeout 0 ret -1 mpp encode put frame failed mpp: put_frame poll on set timeout 0 ret -1 mpp encode put frame failed mpp: put_frame poll on set timeout 0 ret -1 mpp encode put frame failed mpp: put_frame poll on set timeout 0 ret -1 mpp encode put frame failed mpp: put_frame poll on set timeout 0 ret -1 该错误每隔几秒钟出现一次,且没有规律,编码出来的视频数据出现缺帧现象。 测试编码1080P,720P,480P都会出现以上问题,请问如何解决该问题?

sliver-chen commented 5 years ago

把debug标志置位 获取更多的log mpp_env_set_u32("mpi_debug", 1); 之后再查看下问题 不过最好先用mpi_enc_test.c这个用例测试下问题片源的编码