aqws

aqws

0个粉丝

5

问答

0

专栏

0

资料

aqws  发布于  2022-11-02 20:17:05
采纳率 20%
5个问答
3505

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

悬赏金¥ 5
已结题

基于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;

}
```

我来回答
回答3个
时间排序
认可量排序

在学了在学了!

3个粉丝

36

问答

104

专栏

162

资料

在学了在学了! 2022-11-03 08:53:03
认可0

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

aqws
aqws   回复   在学了在学了!  2022-11-03 11:27:27
0

报错信息:

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函数获取图像进行本地播放和编码。

邓晓

21个粉丝

1

问答

0

专栏

19

资料

邓晓 2022-11-03 10:48:53
认可1

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

或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

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

Markdown 语法

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

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区