How to Updating NvDsEventMsgMeta?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) T4
• DeepStream Version 5.1
• JetPack Version (valid for Jetson only)
• TensorRT Version 7.2
• NVIDIA GPU Driver Version (valid for GPU only) 440
• Issue Type( questions, new requirements, bugs) questions
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing) ./deepstream-test5-app -c configs/test5_config_file_src_infer.txt
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
I generate NvDsEventMsgMeta in callback function named bbox_generated_probe_after_analytics . Then, I update the eventMsg->imagePath in the dsexample plug-in.When I get NvDsEventMsgMeta to generate a json format message in the nvmsgconv,I can’t get the updated image url.Why?

Part of dsexample modification

 NvDsMetaList *l = NULL;
      NvDsUserMeta *user_event_meta = NULL;
      user_meta_list = ((NvDsFrameMeta*)frame_meta)->frame_user_meta_list;

      /* Map the buffer so that it can be accessed by CPU */
      if (surface->surfaceList[frame_meta->batch_id].mappedAddr.addr[0] == NULL){
        if (NvBufSurfaceMap (surface, frame_meta->batch_id, 0, NVBUF_MAP_READ_WRITE) != 0){
          GST_ELEMENT_ERROR (dsexample, STREAM, FAILED,
              ("%s:buffer map to be accessed by CPU failed", __func__), (NULL));
          return GST_FLOW_ERROR;
        }
      }

      /* Cache the mapped data for CPU access */
      if(dsexample->inter_buf->memType == NVBUF_MEM_SURFACE_ARRAY)
        NvBufSurfaceSyncForCpu (surface, frame_meta->batch_id, 0);

      in_mat =
          cv::Mat (surface->surfaceList[frame_meta->batch_id].planeParams.height[0],
          surface->surfaceList[frame_meta->batch_id].planeParams.width[0], CV_8UC4,
          surface->surfaceList[frame_meta->batch_id].mappedAddr.addr[0],
          surface->surfaceList[frame_meta->batch_id].planeParams.pitch[0]);

      for (l = user_meta_list; l; l = l->next) {
        user_event_meta = (NvDsUserMeta * )(l->data);
        if (user_event_meta && user_event_meta->base_meta.meta_type == NVDS_EVENT_MSG_META) {
          NvDsEventMsgMeta *eventMsg = NULL;
          eventMsg = (NvDsEventMsgMeta *) user_event_meta->user_meta_data;

          cv::cvtColor (in_mat, *dsexample->cvmat, CV_RGBA2BGR);
   
        
          vector<unsigned char> img_encode;
        
          char* save_path = new char[128];
          cv::imencode(".jpg", *dsexample->cvmat, img_encode);
          fdfs_client->fdfs_uploadfile( img_encode.empty() ? 0 : (const char*)&img_encode[0], "jpg", img_encode.size(), save_path);
          eventMsg->imagePath = save_path;
        }
      }

result of message, imgUrl is null

json output :{
  "apISource" : "apiAction",
  "equipCode" : "1000",
  "videoUrl" : "file:///home/juzheng/code/deepstream-5.1/sources/apps/sample_apps/deepstream-custom-test5/configs/../../../../../samples/streams/sample_1080p_h264.mp4",
  "imgUrl" : null,
  "messageId" : "816bd24e-41d5-4ded-9c77-b2513e26ee3d",
  "object" : {
    "objRect" : [
      72.231414794921875,
      405.16519165039062,
      242.0074462890625,
      924.643798828125
    ],
    "trackId" : 0,
    "objClassId" : 2,
    "confidence" : 0.99668914079666138,
    "attrClassId" : 0,
    "classifyProb" : 0.89588761329650879
  },
  "warningTime" : "2021-08-16 08:57:12",
  "staffChangeTime" : "2021-08-16 08:57:12",
  "memo" : ""
}

Part of NvDsEventMsgMeta modification

typedef struct NvDsEventMsgMeta {
 
  //---------------------------- CUSTOM CODE --------------------------//
  gchar *imagePath;
  // Object meta
  gint source_id;
  gint frame_id;
  gint object_id;
  gchar *object_class;
  // Bbox params
  float left;
  float top;
  float width;
  float height;
  // Classifier meta
  gchar *person_attr;
  guint result_class_id;
  gfloat classify_prob;
  //-------------------------------------------------------------------//


} NvDsEventMsgMeta;

Are you using deepstream-app sample? What is your pipeline?

Yes, I use deepstream-test5-app.
This is my pipeline. pipeline-playing.zip (23.7 KB)

I found a problem.
Under the same frame_id,batch_meta memory address in bbox_generated_probe_after_analytics is different from that in dsexample.
So there are memory copies, but I don’t know where this is happening.

I found it was my own code error.
Sorry, I will close this problem.