MxBase::VideoDecoder 解码器不回调
收藏回复举报
MxBase::VideoDecoder 解码器不回调
新人帖
发表于2025-10-10 17:37:21
0 查看
 

版卡信息:

cann 和 mindx 版本:

# version: 1.0

runtime_running_version=[8.2.0.0.201:8.2.RC1]

compiler_running_version=[8.2.0.0.201:8.2.RC1]

hccl_running_version=[8.2.0.0.201:8.2.RC1]

opp_running_version=[8.2.0.0.201:8.2.RC1]

toolkit_running_version=[8.2.0.0.201:8.2.RC1]

aoe_running_version=[8.2.0.0.201:8.2.RC1]

ncs_running_version=[8.2.0.0.201:8.2.RC1]

runtime_upgrade_version=[8.2.0.0.201:8.2.RC1]

compiler_upgrade_version=[8.2.0.0.201:8.2.RC1]

hccl_upgrade_version=[8.2.0.0.201:8.2.RC1]

opp_upgrade_version=[8.2.0.0.201:8.2.RC1]

toolkit_upgrade_version=[8.2.0.0.201:8.2.RC1]

aoe_upgrade_version=[8.2.0.0.201:8.2.RC1]

ncs_upgrade_version=[8.2.0.0.201:8.2.RC1]

runtime_installed_version=[8.2.0.0.201:8.2.RC1]

compiler_installed_version=[8.2.0.0.201:8.2.RC1]

hccl_installed_version=[8.2.0.0.201:8.2.RC1]

opp_installed_version=[8.2.0.0.201:8.2.RC1]

toolkit_installed_version=[8.2.0.0.201:8.2.RC1]

aoe_installed_version=[8.2.0.0.201:8.2.RC1]

ncs_installed_version=[8.2.0.0.201:8.2.RC1]

MindX SDK mxVision:7.1.RC1

mxVision version:7.1.RC1.b106

Plat: linux x86-64

日志报错:

Running duration (h:mm:ss): 0:00:00

Log line format: [IWEF]yyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg

I20251010 08:58:00.411128 139902749882112 LogManager.hpp:83] Log rotate file number(50).

I20251010 08:58:00.411195 139902741489408 LogManager.hpp:112] Log rotate file time(7).

I20251010 08:58:01.445182 139903510660928 DvppPool.cpp:26] Begin to set channel num.

I20251010 08:58:01.445248 139903510660928 DvppPool.cpp:34] vpcChnNum is 48, jpegdChnNum is 24, jpegeChnNum is 24, pngdChnNum is 24.

I20251010 08:58:01.961529 139903510660928 DvppWrapper.cpp:35] Current chip environment is Ascend310P, DvppWrapper is initialized by DvppWrapperDptrWithHiMpi.

I20251010 08:58:01.961591 139903510660928 DvppWrapper.cpp:384] Image width= 1920, height= 1080.

I20251010 08:58:01.961614 139903510660928 DvppWrapperWithHiMpi.cpp:2833] Run mode: HOST.

I20251010 08:58:01.978343 139903510660928 DvppWrapperWithHiMpi.cpp:542] Successfully set csc matrix as 0.

I20251010 08:58:01.979908 139903510660928 VideoDecoderDptr.hpp:161] Software runMode in ACL_HOST.

I20251010 08:58:01.979935 139903510660928 VideoDecoderDptr.hpp:203] VideoDecoder init successfully.

I20251010 08:58:01.980087 139902217234176 DvppWrapperWithHiMpi.cpp:107] Thread start

I20251010 08:58:01.996241 139902200448768 MemoryHelper.cpp:186] use default hi_mpi_dvpp_malloc/hi_mpi_dvpp_free

I20251010 08:58:01.996668 139902200448768 DvppWrapperBase.cpp:764] Malloc mode has been set as: System malloc

I20251010 08:58:01.996706 139902200448768 AscendStream.cpp:76] SetDevice ret is 0, deviceId is 0

W20251010 08:58:02.103369 139902217234176 DvppWrapperWithHiMpi.cpp:155] Failed to decode, channelId:0, frameId:0, frame flag is 1.

W20251010 08:58:02.206528 139902217234176 DvppWrapperWithHiMpi.cpp:155] Failed to decode, channelId:0, frameId:0, frame flag is 1.

W20251010 08:58:02.309638 139902217234176 DvppWrapperWithHiMpi.cpp:155] Failed to decode, channelId:0, frameId:0, frame flag is 1.

W20251010 08:58:02.412817 139902217234176 DvppWrapperWithHiMpi.cpp:155] Failed to decode, channelId:0, frameId:0, frame flag is 1.

代码:

/* ---------------- 解码回调 ---------------- */

APP_ERROR  DecodeCallback(MxBase::Image &image, uint32_t channelId, uint32_t frameId, void* userData)

{

    GstAscendDec *ascenddec = (GstAscendDec*)userData;

    GST_DEBUG_OBJECT(userData,"decoder call back coming frame:%d",frameId);

    AscendFrame *frame = g_new0(AscendFrame, 1);

    frame->image = image;

    frame->channel_id = channelId;

    frame->frame_id = frameId;

    g_async_queue_push(ascenddec->decoded_queue, frame);

}

/* ---------------- start ---------------- */

static gboolean gst_ascenddec_start (GstVideoDecoder * decoder)

    MxBase::VideoDecodeCallBack cPtr = DecodeCallback;

    ascenddec->config.width = 1920;

    ascenddec->config.height = 1080;

    ascenddec->config.callbackFunc = cPtr;

    ascenddec->config.outputImageFormat = MxBase::ImageFormat::YUV_SP_420;

    GST_INFO_OBJECT (ascenddec, "VideoDecoder create  callback fun:%p",cPtr);

    ascenddec->decoder = std::make_shared<MxBase::VideoDecoder>(ascenddec->config,ascenddec->device_id,ascenddec->channel_id);

   

    return True

}

/* ---------------- handle_frame ---------------- */

static GstFlowReturn gst_ascenddec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)

{

    GstAscendDec *ascenddec = GST_ASCENDDEC(decoder);

    GST_DEBUG_OBJECT(ascenddec, "step1:gst_ascenddec_handle_frame  begin");

    if (!ascenddec->started)

        return GST_FLOW_ERROR;

    if (!frame)

        return GST_FLOW_OK;

    GstMapInfo map_info;

    if (!gst_buffer_map(frame->input_buffer, &map_info, GST_MAP_READ)) {

        gst_video_codec_frame_unref(frame);

        return GST_FLOW_ERROR;

    }

    GST_DEBUG_OBJECT(ascenddec, "step2:gst_ascenddec_handle_frame  decode,map_info size:%d frame number:%d",map_info.size,frame->system_frame_number) ;  

    GST_DEBUG_OBJECT(ascenddec,"First 4 bytes: %02x %02x %02x %02x",

    map_info.data[0], map_info.data[1], map_info.data[2], map_info.data[3]);

    auto data_ptr = std::shared_ptr<uint8_t>(

        map_info.data,

        [](uint8_t* p) {

       

        }

    );

    int nret = ascenddec->decoder->Decode(

        data_ptr,

        map_info.size, frame->system_frame_number, ascenddec);

     GST_DEBUG_OBJECT(ascenddec,"decoder ret:%d",nret);

    usleep(100 * 1000);

    gst_buffer_unmap(frame->input_buffer, &map_info);

    gst_video_codec_frame_unref(frame);

    return GST_FLOW_OK;

}

 

我要发帖子