“”“static GstPadProbeReturn
mux_probe_cb(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) {
GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
const gchar *pad_name = gst_pad_get_name(pad);
g_print(“Buffer received on muxer pad: %s\n”, pad_name);
return GST_PAD_PROBE_OK;
}”“”
This is the function i wrote for checking which sink pad is recieving the data at streammux.
“”"for (i = 1; i < 2; i++) {
GstPad *sinkpad, *srcpad;
GstElement *source_bin;
gchar pad_name[16] = {};
if (is_nvinfer_server) {
source_bin = create_source_bin(
i, “rtsp://admin:admin123@192.168.134.218:554/1/1”, &gpu_id);
} else {
source_bin = create_source_bin(
i, “rtsp://admin:admin123@192.168.134.218:554/1/1”, &gpu_id);
}
if (!source_bin) {
g_printerr("Failed to create source bin. Exiting.\n");
return -1;
}
gst_bin_add(GST_BIN(pipeline), source_bin);
g_snprintf(pad_name, 15, "sink_%u", i);
sinkpad = gst_element_request_pad_simple(streammux, pad_name);
if (!sinkpad) {
g_printerr("Streammux request sink pad failed. Exiting.\n");
return -1;
}
gst_pad_add_probe(sinkpad, GST_PAD_PROBE_TYPE_BUFFER, mux_probe_cb, NULL, NULL);
srcpad = gst_element_get_static_pad(source_bin, "src");
if (!srcpad) {
g_printerr("Failed to get src pad of source bin. Exiting.\n");
return -1;
}
if (gst_pad_link(srcpad, sinkpad) != GST_PAD_LINK_OK) {
g_printerr("Failed to link source bin to stream muxer. Exiting.\n");
return -1;
}
gst_object_unref(srcpad);
gst_object_unref(sinkpad);
}“”"
First , here i called the function at the sink pad connecting uridocebin src
“”" gchar pad_name_sink[16] = “sink_0”;
gchar pad_name_src[16] = “src”;
GstPad *sinkpad, *srcpad;
sinkpad = gst_element_request_pad_simple(streammux, pad_name_sink);
if (!sinkpad) {
g_printerr(“Streammux request sink pad failed. Exiting.\n”);
return -1;
}
gst_pad_add_probe(sinkpad, GST_PAD_PROBE_TYPE_BUFFER, mux_probe_cb, NULL, NULL); “”"
Second i called the function where the appsrc getting conneced to the sink pad of the stream mux.
“”“” if (!use_new_mux) {
g_object_set(G_OBJECT(streammux), “width”, MUXER_OUTPUT_WIDTH, “height”,
MUXER_OUTPUT_HEIGHT, “batch-size”, 2, “live-source”, TRUE,
“batched-push-timeout”, MUXER_BATCH_TIMEOUT_USEC, “gpu-id”,
gpu_id, NULL);
} else {
g_object_set(G_OBJECT(streammux), “batch-size”, 2, “batched-push-timeout”,
MUXER_BATCH_TIMEOUT_USEC, NULL);“”“”
This is how i set teh properties of the streammux.
Please check.