I am trying to run the deepstream-image-meta-test sample found here: /opt/nvidia/deepstream/deepstream-6.1/sources/apps/sample_apps/deepstream-image-meta-test/
This sample app out-of-the-box gives a segmentation fault in nvds_obj_enc_process while trying to save images. I modified the pgie_src_pad_buffer_probe to save full frames instead:
static GstPadProbeReturn
pgie_src_pad_buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer ctx)
{
GstBuffer *buf = (GstBuffer *) info->data;
GstMapInfo inmap = GST_MAP_INFO_INIT;
if (!gst_buffer_map (buf, &inmap, GST_MAP_READ)) {
GST_ERROR ("input buffer mapinfo failed");
return GST_FLOW_ERROR;
}
NvBufSurface *ip_surf = (NvBufSurface *) inmap.data;
gst_buffer_unmap (buf, &inmap);
NvDsObjectMeta *obj_meta = NULL;
guint vehicle_count = 0;
guint person_count = 0;
NvDsMetaList *l_frame = NULL;
NvDsMetaList *l_obj = NULL;
NvDsBatchMeta *batch_meta = gst_buffer_get_nvds_batch_meta (buf);
for (l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) (l_frame->data);
// Create a new NvDsObjectMeta for the entire frame
NvDsObjectMeta full_frame_meta = {0};
full_frame_meta.rect_params.left = 0;
full_frame_meta.rect_params.top = 0;
full_frame_meta.rect_params.width = frame_meta->source_frame_width;
full_frame_meta.rect_params.height = frame_meta->source_frame_height;
full_frame_meta.class_id = PGIE_CLASS_ID_VEHICLE; // or any other class ID
NvDsObjEncUsrArgs userData = { 0 };
/* To be set by user */
userData.saveImg = save_img;
userData.attachUsrMeta = attach_user_meta;
/* Set if Image scaling Required */
userData.scaleImg = FALSE;
userData.scaledWidth = 0;
userData.scaledHeight = 0;
/* Preset */
userData.objNum = 1;
/* Quality */
userData.quality = 80;
/*Main Function Call */
nvds_obj_enc_process (ctx, &userData, ip_surf, &full_frame_meta, frame_meta);
}
nvds_obj_enc_finish (ctx);
return GST_PAD_PROBE_OK;
}
Now, the first full frame is saved, but the segmentation fault still occurs in the call to nvds_obj_enc_finish. Analyzing the stack trace, the issue is with nvds_acquire_user_meta_from_pool which is internally called by the API.
I think using nvds_obj_enc_process might not be the best idea to save the full frame, maybe using the GstBuffer might be better, let me check if I have some sample for that.
@shaunramj , could you upgrade your DeepStream to our latest version? You can just set the userData.isFrame=1 without changing any other code to save the full frame.
There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks