This is a patch for deepstream_test3_app.c
, which works fine. I have tested it on DS-7.0
diff --git a/sources/apps/sample_apps/deepstream-test3/deepstream_test3_app.c b/sources/apps/sample_apps/deepstream-test3/deepstream_test3_app.c
index 4c2cf00..f614a46 100644
--- a/sources/apps/sample_apps/deepstream-test3/deepstream_test3_app.c
+++ b/sources/apps/sample_apps/deepstream-test3/deepstream_test3_app.c
@@ -66,7 +66,6 @@ gchar pgie_classes_str[4][32] = { "Vehicle", "TwoWheeler", "Person",
static gboolean PERF_MODE = FALSE;
-
/* tiler_sink_pad_buffer_probe will extract metadata received on OSD sink pad
* and update params for drawing rectangle, object information etc. */
@@ -208,7 +207,7 @@ cb_newpad (GstElement * decodebin, GstPad * decoder_src_pad, gpointer data)
* NVMM memory features. */
if (gst_caps_features_contains (features, GST_CAPS_FEATURES_NVMM)) {
/* Get the source bin ghost pad */
- GstPad *bin_ghost_pad = gst_element_get_static_pad (source_bin, "src");
+ GstPad *bin_ghost_pad = gst_element_get_static_pad (source_bin, "vsrc");
if (!gst_ghost_pad_set_target (GST_GHOST_PAD (bin_ghost_pad),
decoder_src_pad)) {
g_printerr ("Failed to link decoder src pad to source bin ghost pad\n");
@@ -217,6 +216,14 @@ cb_newpad (GstElement * decodebin, GstPad * decoder_src_pad, gpointer data)
} else {
g_printerr ("Error: Decodebin did not pick nvidia decoder plugin.\n");
}
+ } else if (!strncmp (name, "audio", 5)) {
+ GstPad *bin_ghost_pad = gst_element_get_static_pad (source_bin, "asrc");
+ if (!gst_ghost_pad_set_target (GST_GHOST_PAD (bin_ghost_pad),
+ decoder_src_pad)) {
+ g_printerr ("Failed to link decoder src pad to source bin ghost pad\n");
+ }
+ gst_object_unref (bin_ghost_pad);
+ g_print("Audio pad linked\n");
}
}
@@ -279,7 +286,13 @@ create_source_bin (guint index, gchar * uri)
* now. Once the decode bin creates the video decoder and generates the
* cb_newpad callback, we will set the ghost pad target to the video decoder
* src pad. */
- if (!gst_element_add_pad (bin, gst_ghost_pad_new_no_target ("src",
+ if (!gst_element_add_pad (bin, gst_ghost_pad_new_no_target ("vsrc",
+ GST_PAD_SRC))) {
+ g_printerr ("Failed to add ghost pad in source bin\n");
+ return NULL;
+ }
+
+ if (!gst_element_add_pad (bin, gst_ghost_pad_new_no_target ("asrc",
GST_PAD_SRC))) {
g_printerr ("Failed to add ghost pad in source bin\n");
return NULL;
@@ -360,6 +373,9 @@ main (int argc, char *argv[])
num_sources = argc - 1;
}
+ GstElement *audio_queue = gst_element_factory_make ("queue", "audio-queue1");
+ gst_bin_add (GST_BIN (pipeline), audio_queue);
+
for (i = 0; i < num_sources; i++) {
GstPad *sinkpad, *srcpad;
gchar pad_name[16] = { };
@@ -385,7 +401,7 @@ main (int argc, char *argv[])
return -1;
}
- srcpad = gst_element_get_static_pad (source_bin, "src");
+ srcpad = gst_element_get_static_pad (source_bin, "vsrc");
if (!srcpad) {
g_printerr ("Failed to get src pad of source bin. Exiting.\n");
return -1;
@@ -399,6 +415,21 @@ main (int argc, char *argv[])
gst_object_unref (srcpad);
gst_object_unref (sinkpad);
+ GstPad *asrcpad = gst_element_get_static_pad (source_bin, "asrc");
+ if (!asrcpad) {
+ g_printerr ("Failed to get src pad of source bin. Exiting.\n");
+ return -1;
+ }
+
+ GstPad *aqsinkpad = gst_element_get_static_pad (audio_queue, "sink");
+ if (gst_pad_link (asrcpad, aqsinkpad) != GST_PAD_LINK_OK) {
+ g_printerr ("Failed to link source bin to stream muxer. Exiting.\n");
+ return -1;
+ }
+
+ gst_object_unref (asrcpad);
+ gst_object_unref (aqsinkpad);
+
if (yaml_config) {
src_list = src_list->next;
}
@@ -415,6 +446,8 @@ main (int argc, char *argv[])
pgie = gst_element_factory_make ("nvinfer", "primary-nvinference-engine");
}
+ GstElement *audio_fakesink = gst_element_factory_make ("fakesink", "audio-fakesink");
+
/* Add queue elements between every two elements */
queue1 = gst_element_factory_make ("queue", "queue1");
queue2 = gst_element_factory_make ("queue", "queue2");
@@ -445,7 +478,8 @@ main (int argc, char *argv[])
#ifdef __aarch64__
sink = gst_element_factory_make ("nv3dsink", "nvvideo-renderer");
#else
- sink = gst_element_factory_make ("nveglglessink", "nvvideo-renderer");
+ //sink = gst_element_factory_make ("nveglglessink", "nvvideo-renderer");
+ sink = gst_element_factory_make ("fakesink", "nvvideo-renderer");
#endif
}
}
@@ -540,7 +574,7 @@ main (int argc, char *argv[])
/* Set up the pipeline */
/* we add all elements into the pipeline */
gst_bin_add_many (GST_BIN (pipeline), queue1, pgie, queue2, nvdslogger, tiler,
- queue3, nvvidconv, queue4, nvosd, queue5, sink, NULL);
+ queue3, nvvidconv, queue4, nvosd, queue5, sink, audio_fakesink, NULL);
/* we link the elements together
* nvstreammux -> nvinfer -> nvdslogger -> nvtiler -> nvvidconv -> nvosd
* -> video-renderer */
@@ -550,6 +584,11 @@ main (int argc, char *argv[])
return -1;
}
+ if (!gst_element_link_many (audio_queue, audio_fakesink, NULL)) {
+ g_printerr ("Elements could not be linked 2. Exiting.\n");
+ return -1;
+ }
+
/* Lets add probe to get informed of the meta data generated, we add probe to
* the sink pad of the osd element, since by that time, the buffer would have
* had got all the metadata. */