华为昇腾310B1平台视频解码失败[ERROR] Send frame to vdec failed, errorno:507018

目录

[1 [ERROR] Send frame to vdec failed, errorno:507018](#1 [ERROR] Send frame to vdec failed, errorno:507018)

[2 bug解决尝试1](#2 bug解决尝试1)

[3 bug解决尝试2](#3 bug解决尝试2)

[4 最终解决方法](#4 最终解决方法)

参考文献:


1 [ERROR] Send frame to vdec failed, errorno:507018

某项目中的代码运行报错 [ERROR] Send frame to vdec failed, errorno:507018

cpp 复制代码
    AclLiteError VdecHelper::Process(shared_ptr<FrameData> frameData, void* userData) {
        // create input desc
        AclLiteError atlRet = CreateInputStreamDesc(frameData);
        if (atlRet != ACLLITE_OK) {
            ACLLITE_LOG_ERROR("Create stream desc failed");
            return atlRet;
        }

        if (!frameData->isFinished) {
            // create out desc
            atlRet = CreateOutputPicDesc(outputPicSize_.load());
            if (atlRet != ACLLITE_OK) {
                ACLLITE_LOG_ERROR("Create pic desc failed");
                return atlRet;
            }
        }
        else {
            outputPicDesc_ = acldvppCreatePicDesc();
            if (outputPicDesc_ == nullptr) {
                ACLLITE_LOG_ERROR("Create vdec output pic desc failed");
                return ACLLITE_ERROR_CREATE_PIC_DESC;
            }
        }

        // send data to dvpp vdec to decode
        ret = aclvdecSendFrame(vdecChannelDesc_, inputStreamDesc_,
            outputPicDesc_, nullptr, userData);
        if (ret != ACL_SUCCESS) {
            ACLLITE_LOG_ERROR("Send frame to vdec failed, errorno:%d", ret);
            return ACLLITE_ERROR_VDEC_SEND_FRAME;
        }

        return ACLLITE_OK;
    }

    void VdecHelper::SetOutputPicSize(uint32_t picSize) {
        if (picSize < outputPicSize_.load()) {
            outputPicSize_.store(picSize);
        }
    }

用vscode调试发现

发现正常和报错时的一些变量也没什么区别,

2 bug解决尝试1

然后网上搜507018的错误码,找到如下链接昇腾社区-官网丨昇腾万里 让智能无所不及

这上面就是说每次都要重新配置描述类型,但是我看了下我的代码里面已经是每次都重新配置描述类型了,该方法行不通。

3 bug解决尝试2

不知道怎么做了,去下载华为官方的sample,然后先跑demo试试,去下载samples: CANN Samples - Gitee.com

https://gitee.com/ascend/samples/tree/master/cplusplus/level2_simple_inference/0_data_process

然后编译运行这个samples-master/cplusplus/level2_simple_inference/0_data_process/vdec

在代码中增加这一行打印

cpp 复制代码
    while (restLen > 0) {
        //INFO_LOG("------------------------- ");
        // inBufferDev means the memory for input video data by Device, and inBufferSize means the memory size
        ret = acldvppSetStreamDescData(streamInputDesc_, inBufferDev);
        ret = acldvppSetStreamDescSize(streamInputDesc_, inBufferSize);

        // Device memory g_picOutBufferDev is used to store output data decoded by VDEC
        ret = acldvppMalloc(&g_picOutBufferDev, dataSize);

        // Create output image description information, set the image description information properties
        // picOutputDesc_ is acldvppPicDesc
        picOutputDesc_ = acldvppCreatePicDesc();
        ret = acldvppSetPicDescData(picOutputDesc_, g_picOutBufferDev);
        ret = acldvppSetPicDescSize(picOutputDesc_, dataSize);
        ret = acldvppSetPicDescFormat(picOutputDesc_, static_cast<acldvppPixelFormat>(format_));

        /* Perform video stream decoding. After decoding each frame of data, the system automatically
         calls callback callback function to write the decoded data to the file, and then timely release
         relevant resources */
        ret = aclvdecSendFrame(vdecChannelDesc_, streamInputDesc_, picOutputDesc_, nullptr, nullptr);
        printf("ret  =================%d\n", ret);
        restLen = restLen - 1;
    }

运行结果如下

demo报同样的错误,但是我发现如果原视频用华为的std::string filePath = "../data/vdec_h265_1frame_rabbit_1280x720.h265"就不报错,换成我自己的几个视频就报错。

4 最终解决方法

华为技术支持让试试:samples: CANN Samples - Gitee.com

https://gitee.com/ascend/samples/tree/master/cplusplus/level1_single_api/7_dvpp/vdec_sample

我试了下这个,发现是可以,没报错,那么需要将我的工程中的解码代码全都替换成这个sample的这些接口,需要把解码代码重写。

另外下图是这个sample对应的解码原理

参考文献:

华为云论坛_云计算论坛_开发者论坛_技术论坛-华为云

samples: CANN Samples - Gitee.com

samples: CANN Samples - Gitee.com

昇腾社区-官网丨昇腾万里 让智能无所不及

相关推荐
KyollBM28 分钟前
【CF】Day75——CF (Div. 2) B (数学 + 贪心) + CF 882 (Div. 2) C (01Trie | 区间最大异或和)
c语言·c++·算法
feiyangqingyun40 分钟前
Qt/C++开发监控GB28181系统/取流协议/同时支持udp/tcp被动/tcp主动
c++·qt·udp·gb28181
CV点灯大师43 分钟前
C++算法训练营 Day10 栈与队列(1)
c++·redis·算法
成工小白2 小时前
【C++ 】智能指针:内存管理的 “自动导航仪”
开发语言·c++·智能指针
sc写算法2 小时前
基于nlohmann/json 实现 从C++对象转换成JSON数据格式
开发语言·c++·json
SunkingYang2 小时前
C++中如何遍历map?
c++·stl·map·遍历·方法
Andrew_Xzw2 小时前
数据结构与算法(快速基础C++版)
开发语言·数据结构·c++·python·深度学习·算法
库库的里昂2 小时前
【C++从练气到飞升】03---构造函数和析构函数
开发语言·c++
momo卡2 小时前
MinGW-w64的安装详细步骤(c_c++的编译器gcc、g++的windows版,win10、win11真实可用)
c语言·c++·windows
凤年徐5 小时前
【数据结构初阶】单链表
c语言·开发语言·数据结构·c++·经验分享·笔记·链表