Please provide complete information as applicable to your setup.
**• Hardware Platform (Jetson / GPU)**Jetson Xavier AGX
• DeepStream Version6.1.1
**• JetPack Version (valid for Jetson only)**5.0.2
This is my code , is there any problem with my code?
static void
bbox_generated_probe_after_analytics (AppCtx * appCtx, GstBuffer * buf,
NvDsBatchMeta * batch_meta, guint index)
{
NvDsObjectMeta *obj_meta = NULL;
GstClockTime buffer_pts = 0;
guint32 stream_id = 0;
for (NvDsMetaList * l_frame = batch_meta->frame_meta_list; l_frame != NULL;
l_frame = l_frame->next) {
NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) l_frame->data;
stream_id = frame_meta->source_id;
GstClockTime buf_ntp_time = 0;
if (playback_utc == FALSE) {
/** Calculate the buffer-NTP-time
* derived from this stream's RTCP Sender Report here:
*/
StreamSourceInfo *src_stream = &testAppCtx->streams[stream_id];
buf_ntp_time = frame_meta->ntp_timestamp;
if (buf_ntp_time < src_stream->last_ntp_time) {
NVGSTDS_WARN_MSG_V ("Source %d: NTP timestamps are backward in time."
" Current: %lu previous: %lu", stream_id, buf_ntp_time,
src_stream->last_ntp_time);
}
src_stream->last_ntp_time = buf_ntp_time;
}
GList *l;
for (l = frame_meta->obj_meta_list; l != NULL; l = l->next) {
/* Now using above information we need to form a text that should
* be displayed on top of the bounding box, so lets form it here. */
obj_meta = (NvDsObjectMeta *) (l->data);
{
/**
* Enable only if this callback is after tiler
* NOTE: Scaling back code-commented
* now that bbox_generated_probe_after_analytics() is post analytics
* (say pgie, tracker or sgie)
* and before tiler, no plugin shall scale metadata and will be
* corresponding to the nvstreammux resolution
*/
float scaleW = 0;
float scaleH = 0;
/* Frequency of messages to be send will be based on use case.
* Here message is being sent for first object every 30 frames.
*/
buffer_pts = frame_meta->buf_pts;
if (!appCtx->config.streammux_config.pipeline_width
|| !appCtx->config.streammux_config.pipeline_height) {
g_print ("invalid pipeline params\n");
return;
}
LOGD ("stream %d==%d [%d X %d]\n", frame_meta->source_id,
frame_meta->pad_index, frame_meta->source_frame_width,
frame_meta->source_frame_height);
scaleW =
(float) frame_meta->source_frame_width /
appCtx->config.streammux_config.pipeline_width;
scaleH =
(float) frame_meta->source_frame_height /
appCtx->config.streammux_config.pipeline_height;
if (playback_utc == FALSE) {
/** Use the buffer-NTP-time derived from this stream's RTCP Sender
* Report here:
*/
buffer_pts = buf_ntp_time;
}
/** Generate NvDsEventMsgMeta for every object */
NvDsEventMsgMeta *msg_meta =
(NvDsEventMsgMeta *) g_malloc0 (sizeof (NvDsEventMsgMeta));
generate_event_msg_meta (msg_meta, obj_meta->class_id, TRUE,
/**< useTs NOTE: Pass FALSE for files without base-timestamp in URI */
buffer_pts,
appCtx->config.multi_source_config[stream_id].uri, stream_id,
appCtx->config.multi_source_config[stream_id].camera_id,
obj_meta, scaleW, scaleH, frame_meta);
char *confidence_msg = g_strdup_printf("Confidence: %.2f", obj_meta->confidence);
msg_meta->extMsgSize = strlen(confidence_msg) + 1; // +1 for null terminator
msg_meta->extMsg = confidence_msg;
testAppCtx->streams[stream_id].meta_number++;
NvDsUserMeta *user_event_meta =
nvds_acquire_user_meta_from_pool (batch_meta);
if (user_event_meta) {
/*
* Since generated event metadata has custom objects for
* Vehicle / Person which are allocated dynamically, we are
* setting copy and free function to handle those fields when
* metadata copy happens between two components.
*/
user_event_meta->user_meta_data = (void *) msg_meta;
user_event_meta->base_meta.batch_meta = batch_meta;
user_event_meta->base_meta.meta_type = NVDS_EVENT_MSG_META;
user_event_meta->base_meta.copy_func =
(NvDsMetaCopyFunc) meta_copy_func;
user_event_meta->base_meta.release_func =
(NvDsMetaReleaseFunc) meta_free_func;
nvds_add_user_meta_to_frame (frame_meta, user_event_meta);
} else {
g_print ("Error in attaching event meta to buffer\n");
}
}
}
testAppCtx->streams[stream_id].frameCount++;
}
}