I was facing the same issue with object-id, the mistake i made was i added the probe in source pad of nvinfer element. But object-id is set by nvtracker element so i should add the probe in source pad of nvtracker or other elements that are downstream to nvtracker.
you can resolve it by changing this code
infer_src_pad = gst_element_get_static_pad (pgie, "src");
if (!infer_src_pad)
g_print ("Unable to get source pad\n");
else
gst_pad_add_probe (infer_src_pad, GST_PAD_PROBE_TYPE_BUFFER,
nvinfer_src_pad_buffer_probe, NULL, NULL);
to this code.
infer_src_pad = gst_element_get_static_pad (nvtracker, "src");
if (!infer_src_pad)
g_print ("Unable to get source pad\n");
else
gst_pad_add_probe (infer_src_pad, GST_PAD_PROBE_TYPE_BUFFER,
nvinfer_src_pad_buffer_probe, NULL, NULL);