首页问答详情

Hi3536平台使用HI_MPI_VENC_SendFrame解码报错0xa0088012

¥ 5
已结题
aqws
aqws  发布于  2022-11-02 20:17:05
采纳率 34%
3个问答

基于Hi3536搭建的远程视频传输系统,希望可以在本地和远端进行实时视频传输和显示,本地摄像头采集图像后,经VDEC处理送入VPSS模块,VDEC模块和VPSS模块绑定,VPSS模块创建一个图像组0和两个通道0和1分别向VENC模块和本地VO模块发送数据,在自定义的方法中,通过HI_MPI_VPSS_GetChnFrame()从VPSS模块通道0获取一帧图像,然后调用HI_MPI_VO_SendFrame()发送给VO;通过HI_MPI_VPSS_GetChnFrame()从VPSS模块通道1处获取一帧图像,然后调用HI_MPI_VENC_SendFrame()发送给VENC。
出现的问题是VO收到了视频帧,但显示时有明显卡顿;VENC报错0xA0088012,表示VENC系统繁忙,无法编码视频并发送。```cpp
int Hi3536Cap::vpssic() {
VIDEO_FRAME_INFO_S encFrame, procFrame; // frame_info
HI_S32 s32MilliSec = 200;

  1. HI_S32 ret = HI_MPI_VPSS_GetChnFrame(0, 0, &encFrame, s32MilliSec);
  2. if (HI_SUCCESS != ret)
  3. {
  4. LOG("[Hi3536Disp::vpsspic] HI_MPI_VPSS_GetChnFrame ENC FRAME failed, return %#x\n", ret);
  5. return -1;
  6. }
  7. // get_proc_frame
  8. ret = HI_MPI_VPSS_GetChnFrame(0, 1, &procFrame, s32MilliSec);
  9. if (HI_SUCCESS != ret)
  10. {
  11. LOG("[Hi3536Disp::vpsspic] HI_MPI_VPSS_GetChnFrame PROC FRAME failed, return %#x\n", ret);
  12. return -1;
  13. }
  14. HI_S32 s32Ret = HI_SUCCESS;
  15. VENC_CHN VeH264Chn = 0;
  16. VO_LAYER VoLayer = 0;
  17. VO_CHN VoChn = 0;
  18. bool bEncode = true;
  19. bool bVo = true;
  20. if(bVo)
  21. {
  22. s32Ret = HI_MPI_VO_SendFrame(VoLayer, VoChn, &encFrame, s32MilliSec);
  23. if (HI_SUCCESS != s32Ret)
  24. {
  25. LOG("HI_MPI_VO_SendFrame,Error(%#x)\n",s32Ret);
  26. }
  27. }
  28. // Send to venc
  29. if(bEncode)
  30. {
  31. s32Ret = HI_MPI_VENC_SendFrame(VeH264Chn, &encFrame, s32MilliSec);
  32. if(HI_SUCCESS != s32Ret)
  33. {
  34. LOG("HI_MPI_VENC_SendFrame fail with errno: %#x\n",s32Ret);
  35. }
  36. }
  37. HI_MPI_VPSS_ReleaseChnFrame(0, 1, &procFrame);
  38. HI_MPI_VPSS_ReleaseChnFrame(0, 0, &encFrame);
  39. return 0;

}
```

我来回答
1360
0
0
回答
2个
易百纳技术社区
在学了在学了! 发布于2022-11-03 08:53:03
人在车底,非常的菜。

cat /dev/logmpp
看一下报错信息呢
vdec vpss vo venc的设置信息也得提供出来看看嘛,把/proc/umap/下的信息dump出来
就一小段代码,也不太能搞清楚啥情况

0
易百纳技术社区
aqws   回复   在学了在学了!   2022-11-03 11:27:27

报错信息:

VDEC设置:

HI_VOID HI3536_VDEC_ChnAttr(HI_S32 s32ChnNum, VDEC_CHN_ATTR_S *pstVdecChnAttr, PAYLOAD_TYPE_E enType, SIZE_S *pstSize)
{
    HI_S32 i;
    for(i = 0; i < s32ChnNum; i++) {
        pstVdecChnAttr[i].enType = enType;
        pstVdecChnAttr[i].u32BufSize = 3 * pstSize->u32Width * pstSize->u32Height / 2;
        pstVdecChnAttr[i].u32Priority = 5;
        pstVdecChnAttr[i].u32PicWidth = pstSize->u32Width;
        pstVdecChnAttr[i].u32PicHeight = pstSize->u32Height;

        if(PT_H264 == enType || PT_MP4VIDEO == enType)
        {
            pstVdecChnAttr[i].stVdecVideoAttr.enMode = VIDEO_MODE_STREAM;
            pstVdecChnAttr[i].stVdecVideoAttr.u32RefFrameNum = 3;
            pstVdecChnAttr[i].stVdecVideoAttr.bTemporalMvpEnable = HI_FALSE;
        }
        else if(PT_JPEG == enType || PT_MJPEG == enType)
        {
            pstVdecChnAttr[i].stVdecJpegAttr.enMode = VIDEO_MODE_FRAME;
            pstVdecChnAttr[i].stVdecJpegAttr.enJpegFormat = JPG_COLOR_FMT_YCBCR420;
        }
        else if(PT_H265 == enType)
        {
            pstVdecChnAttr[i].stVdecVideoAttr.enMode=VIDEO_MODE_STREAM;
            pstVdecChnAttr[i].stVdecVideoAttr.u32RefFrameNum = 2;
            pstVdecChnAttr[i].stVdecVideoAttr.bTemporalMvpEnable = HI_TRUE;
        }
    }
}

HI_S32 HI3536_VDEC_Start(HI_S32 s32ChnNum, VDEC_CHN_ATTR_S *pstAttr)
{
    HI_S32  s32Ret, i;
    HI_U32  u32BlkCnt = 10;
    VDEC_CHN_POOL_S stPool;

    for(i=0; i<s32ChnNum; i++)
    {    
        if(g_s32VBSource == 1)
        {
            s32Ret = HI_MPI_VDEC_SetChnVBCnt(i, u32BlkCnt);
            if (s32Ret != HI_SUCCESS)
            {
                LOG("[%s] HI_MPI_VDEC_SetChnVBCnt failed, return 0x%x\n", __FUNCTION__, s32Ret);
                return HI_FAILURE;
            }                
        }

        s32Ret = HI_MPI_VDEC_CreateChn(i, &pstAttr[i]);    
        if (s32Ret != HI_SUCCESS)
        {
            LOG("[%s] HI_MPI_VDEC_CreateChn failed, return 0x%x\n", __FUNCTION__, s32Ret);
            return HI_FAILURE;
        }

        if (g_s32VBSource == 2)
        {
            // stPool.hPicVbPool = g_ahVbPool[0];
            stPool.hPmvVbPool = -1;
            s32Ret = HI_MPI_VDEC_AttachVbPool(i, &stPool);
            if (s32Ret != HI_SUCCESS)
            {
                LOG("[%s] HI_MPI_VDEC_AttachVbPool failed, return 0x%x\n", __FUNCTION__, s32Ret);
                return HI_FAILURE;
            }    
        }

        s32Ret = HI_MPI_VDEC_SetDisplayMode(i, VIDEO_DISPLAY_MODE_PREVIEW);
        if (s32Ret != HI_SUCCESS)
        {
            LOG("[%s] HI_MPI_VDEC_SetDisplayMode failed, return 0x%x\n", __FUNCTION__, s32Ret);
            HI_MPI_VDEC_DestroyChn(0);
            return HI_FAILURE;
        }

        s32Ret = HI_MPI_VDEC_StartRecvStream(i);
        if (s32Ret != HI_SUCCESS)
        {
            LOG("[%s] HI_MPI_VDEC_StartRecvStream failed, return 0x%x\n", __FUNCTION__, s32Ret);
            HI_MPI_VDEC_DestroyChn(0);
            return HI_FAILURE;
        }
    }

    return HI_SUCCESS;
}

VPSS设置:

HI_S32 HI3536_VPSS_Start(HI_S32 s32GrpCnt, SIZE_S *pstSize, HI_S32 s32ChnCnt, VPSS_GRP_ATTR_S *pstVpssGrpAttr, HI_U8 chnMode)
{
    VPSS_GRP VpssGrp;
    VPSS_CHN VpssChn;
    VPSS_GRP_ATTR_S stGrpAttr = {0};
    VPSS_GRP_PARAM_S stVpssParam = {0};
    VPSS_CHN_ATTR_S stChnAttr;
    VPSS_CHN_MODE_S stVpssMode;
    VPSS_FRAME_RATE_S stVpssFrmRate = {30, 30};
    HI_U32 u32Depth = 8; 
    HI_S32 s32Ret = HI_SUCCESS;
    HI_S32 i, j;

    /*** Set Vpss Grp Attr ***/
    if(pstVpssGrpAttr == NULL) {
        stGrpAttr.u32MaxW = max_width; 
        stGrpAttr.u32MaxH = max_height; 
        stGrpAttr.bIeEn = HI_FALSE; 
        stGrpAttr.bDciEn = HI_FALSE; 
        stGrpAttr.bNrEn = HI_TRUE; 
        stGrpAttr.bHistEn = HI_FALSE; 
        stGrpAttr.enDieMode = VPSS_DIE_MODE_NODIE; 
        stGrpAttr.bEsEn = HI_FALSE; 
        stGrpAttr.enPixFmt = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
    }
    else {
        memcpy(&stGrpAttr, pstVpssGrpAttr, sizeof(VPSS_GRP_ATTR_S));
    }

    for(i = 0; i < s32GrpCnt; ++i) {
        VpssGrp = i;
        /*** create vpss group ***/
        s32Ret = HI_MPI_VPSS_CreateGrp(VpssGrp, &stGrpAttr);
        if (s32Ret != HI_SUCCESS)
        {
            LOG("[%s] HI_MPI_VPSS_CreateGrp failed with %#x!\n", __FUNCTION__, s32Ret);
            return HI_FAILURE;
        }

        s32Ret = HI_MPI_VPSS_SetGrpFrameRate(VpssGrp, &stVpssFrmRate);
        if (HI_SUCCESS != s32Ret)
        {
            LOG("[%s] HI_MPI_VPSS_SetGrpFrameRate failed with errno: %#x!\n", __FUNCTION__, s32Ret);
            return HI_FAILURE;
        }

        /*** enable vpss chn, with frame ***/
        for(j=0; j<s32ChnCnt; j++)
        {
            VpssChn = j;
            /* Set Vpss Chn attr */
            stChnAttr.bSpEn = HI_FALSE;
            stChnAttr.bUVInvert = HI_FALSE;
            stChnAttr.bBorderEn = HI_TRUE;
            stChnAttr.stBorder.u32Color = 0xff00;
            stChnAttr.stBorder.u32LeftWidth = 2;
            stChnAttr.stBorder.u32RightWidth = 2;
            stChnAttr.stBorder.u32TopWidth = 2;
            stChnAttr.stBorder.u32BottomWidth = 2;

            s32Ret = HI_MPI_VPSS_SetChnAttr(VpssGrp, VpssChn, &stChnAttr);
            if (s32Ret != HI_SUCCESS)
            {
                LOG("[%s] HI_MPI_VPSS_SetChnAttr failed with %#x\n", __FUNCTION__, s32Ret);
                return HI_FAILURE;
            }
            LOG("set Channel %d mode is %d\n", j, (chnMode >> j)&1);
            if((chnMode >> j)&1) {
                LOG("set Channel %d is user mode\n", j);
                s32Ret = HI_MPI_VPSS_GetChnMode(VpssGrp, VpssChn, &stVpssMode); 
                if(s32Ret != HI_SUCCESS) 
                {   
                    LOG("[%s] HI_MPI_VPSS_GetChnMode failed with %#x\n", __FUNCTION__, s32Ret);
                    return -4; 
                }

                stVpssMode.enChnMode = VPSS_CHN_MODE_USER; 
                stVpssMode.enPixelFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420; 
                if(j == 0) {
                    stVpssMode.u32Width = 1920; 
                    stVpssMode.u32Height = 1080;
                } else {
                    stVpssMode.u32Width = 480; 
                    stVpssMode.u32Height = 270;
                }

                s32Ret = HI_MPI_VPSS_SetChnMode(VpssGrp, VpssChn, &stVpssMode); 
                if(s32Ret != HI_SUCCESS) 
                {   LOG("[%s] HI_MPI_VPSS_SetChnMode failed, return 0x%x\n", __FUNCTION__, s32Ret);
                    return -5; 
                }

                HI_MPI_VPSS_SetDepth(VpssGrp, VpssChn, u32Depth); 
            }

            s32Ret = HI_MPI_VPSS_EnableChn(VpssGrp, VpssChn);
            if (s32Ret != HI_SUCCESS)
            {
                LOG("[%s] HI_MPI_VPSS_EnableChn failed with %#x\n", __FUNCTION__, s32Ret);
                return HI_FAILURE;
            }
        }

        /*** start vpss group ***/
        s32Ret = HI_MPI_VPSS_StartGrp(VpssGrp);
        if (s32Ret != HI_SUCCESS)
        {
            LOG("[%s] HI_MPI_VPSS_StartGrp failed with %#x\n", __FUNCTION__, s32Ret);
            return HI_FAILURE;
        }
    }
    VDEC_BindVpss(0, 0);
    return HI_SUCCESS;
}

打开VENC模块接收图像:

int hi3536_enc_open()
{
    VENC_CHN_ATTR_S vencChnAttr;
    bzero(&vencChnAttr, sizeof(VENC_CHN_ATTR_S));

    vencChnAttr.stVeAttr.enType = PT_H264;
    VENC_ATTR_H264_S &h264Attr  = vencChnAttr.stVeAttr.stAttrH264e;
    h264Attr.u32MaxPicWidth     = 1920;
    h264Attr.u32MaxPicHeight    = 1080;
    h264Attr.u32PicWidth        = 1280;
    h264Attr.u32PicHeight       = 720;
    h264Attr.u32BufSize         = h264Attr.u32MaxPicWidth * h264Attr.u32MaxPicHeight * 3 / 2;
    h264Attr.u32Profile         = 0;        // 0: baseline; 1:MP; 2:HP
    h264Attr.bByFrame           = HI_TRUE;  // 按帧获取

    vencChnAttr.stRcAttr.enRcMode = VENC_RC_MODE_H264VBR;
    VENC_ATTR_H264_VBR_S &h264vbr = vencChnAttr.stRcAttr.stAttrH264Vbr;
    h264vbr.u32Gop          = 30;
    h264vbr.u32SrcFrmRate   = 30;
    h264vbr.fr32DstFrmRate  = 30;
    h264vbr.u32StatTime     = 1;
    h264vbr.u32MinQp        = 10;
    h264vbr.u32MaxQp        = 40;
    h264vbr.u32MaxBitRate   = 2000;

    HI_S32 ret = HI_MPI_VENC_CreateChn(0, &vencChnAttr);
    if (HI_SUCCESS != ret)
    {
        LOG("[%s] HI_MPI_VENC_CreateChn failed, return 0x%x\n", __FUNCTION__, ret);
        return -1;
    }

    ret = HI_MPI_VENC_StartRecvPic(0);
    if (HI_SUCCESS != ret)
    {
        LOG("[%s] HI_MPI_VENC_StartRecvPic failed, return 0x%x\n", __FUNCTION__, ret);
        HI_MPI_VENC_DestroyChn(0);
        return -2;
    }

    return 0;
}

VO设置:

int hi3536_vhd0_open()
{
    VO_DEV voDev     = VO_DEV_DHD0;
    VO_LAYER voLayer = VO_LAYER_VHD0;

    VO_PUB_ATTR_S voPubAttr = { 0 };
    voPubAttr.enIntfSync = VO_OUTPUT_1080P60;
    voPubAttr.enIntfType = VO_INTF_HDMI | VO_INTF_VGA;

    HI_S32 ret = HI_MPI_VO_SetPubAttr(voDev, &voPubAttr);
    if (HI_SUCCESS != ret)
    {
        LOG("[%s] HI_MPI_VO_SetPubAttr failed, return 0x%x\n", __FUNCTION__, ret);
        return -1;
    }

    ret = HI_MPI_VO_Enable(voDev);
    if (HI_SUCCESS != ret)
    {
        LOG("[%s] HI_MPI_VO_Enable failed, return 0x%x\n", __FUNCTION__, ret);
        return -2;
    }

    VO_VIDEO_LAYER_ATTR_S voLayerAttr = { {0, 0, 1920, 1080 }, { 1920, 1080 }, 30, PIXEL_FORMAT_YUV_SEMIPLANAR_420 };
    ret = HI_MPI_VO_SetVideoLayerAttr(voLayer, &voLayerAttr);
    if (HI_SUCCESS != ret)
    {
        LOG("[%s] HI_MPI_VO_SetVideoLayerAttr failed, return 0x%x\n", __FUNCTION__, ret);
        HI_MPI_VO_Disable(voDev);
        return -3;
    }

    ret = HI_MPI_VO_EnableVideoLayer(voLayer);
    if (HI_SUCCESS != ret)
    {
        LOG("[%s] HI_MPI_VO_EnableVideoLayer failed, return 0x%x\n", __FUNCTION__, ret);
        HI_MPI_VO_Disable(voDev);
        return -4;
    }

    VO_CHN_ATTR_S chnAttr = { 0, { 0, 0, 1920, 1080 } };
    ret = HI_MPI_VO_SetChnAttr(voLayer, 0, &chnAttr);
    if (HI_SUCCESS != ret)
    {
        LOG("[%s] HI_MPI_VO_SetChnAttr failed, return 0x%x\n", __FUNCTION__, ret);
        HI_MPI_VO_DisableVideoLayer(voLayer);
        HI_MPI_VO_Disable(voDev);
        return -5;
    }

    ret = HI_MPI_VO_EnableChn(voLayer, 0);
    if (HI_SUCCESS != ret)
    {
        LOG("[%s] HI_MPI_VO_EnableChn failed, return 0x%x\n", __FUNCTION__, ret);
        HI_MPI_VO_DisableVideoLayer(voLayer);
        HI_MPI_VO_Disable(voDev);
        return -6;
    }
    return 0;
}

VENC的proc信息:

VPSS的proc信息:

VO的proc信息:



然后我是客户端初始化时初始化各个模块,开启一个线程进行采样回调,摄像头采集图像后先通过VDEC解码,然后调用帖子里的vpssic函数获取图像进行本地播放和编码。

0
易百纳技术社区
邓晓 发布于2022-11-03 10:48:53
安防产品应用开发->安防产品媒体开发->安防芯片SDK开发

vpss->venc(vo)用bind方式试试

1

Markdown 语法

  • 加粗 **内容**
  • 斜体 *内容*
  • 删除线 ~~内容~~
  • 引用 > 引用内容
  • 代码 `代码`
  • 代码块 ```编程语言↵代码```
  • 链接 [链接标题](url)
  • 无序列表 - 内容
  • 有序列表 1. 内容
  • 缩进 内容
  • 图片 ![alt](url)

Markdown 语法

  • 加粗 **内容**
  • 斜体 *内容*
  • 删除线 ~~内容~~
  • 引用 > 引用内容
  • 代码 `代码`
  • 代码块 ```编程语言↵代码```
  • 链接 [链接标题](url)
  • 无序列表 - 内容
  • 有序列表 1. 内容
  • 缩进 内容
  • 图片 ![alt](url)
+ 添加网盘链接/附件
或将文件直接拖到这里
悬赏:
EBC
网盘
* 网盘链接:
* 提取码:
悬赏:
EBC
Loading...
易百纳技术社区
确定要删除此文章、专栏、评论吗?
确定
取消
易百纳技术社区
易百纳技术社区
在专栏模块发布专栏,可获得其他E友的打赏
易百纳技术社区
回答悬赏问答,被题主采纳后即可获得悬赏金
易百纳技术社区
在上传资料时,有价值的资料可设置为付费资源
易百纳技术社区
达到一定金额,收益即可提现~
收益也可用来充值ebc,下载资料、兑换礼品更容易
易百纳技术社区
活动规则
  • 1.周任务为周期性任务,每周周一00:00刷新,上周完成的任务不会累计到本周,本周需要从头开始任务,当前任务完成后才可以完成下一个任务
  • 2.发布的专栏与资料需要与平台的板块有相关性,禁止注水,专栏/资料任务以审核通过的篇数为准
  • 3.任务完成后,现金奖励直接打款到微信账户;EBC/收益将自动发放到个人账户,可前往“我的钱包”查看;其他奖励请联系客服兑换
  • 4.每周最后三个任务将会有以下奖品掉落:社区热卖开发板、小米音响、视频年度会员、京东卡、华为手机等等
易百纳技术社区
升级提醒
易百纳技术社区

恭喜您由入门

社区送出礼品一份

请填写您的收件地址,礼品将在3个工作日寄出

易百纳技术社区