I am attempting to get a test pipeline. I want to see if I can get an appsrc to take solid colour panes and stream them, from the jetson, to my laptop, using RTP. However, when I try to set host and port on the udpsink, my program crashes.
The snippet which causes the crash is here:
g_object_set(G_OBJECT(app->udpsink),
"host", G_TYPE_STRING, "192.168.1.176",
"port", G_TYPE_INT, 5000,
nullptr);
Code to demonstrate the issue:
typedef struct {
GstPipeline *pipeline;
GstElement *src, *convert, *encode, *pay, *udpsink;
GMainLoop *loop;
guint sourceid;
FILE *file;
}gst_app_t;
int main()
{
gst_app_t* app = new gst_app_t();
GstBus *bus;
GstStateChangeReturn state_ret;
gst_init(nullptr, nullptr);
app->src = gst_element_factory_make("appsrc", "appsrc");
app->convert = gst_element_factory_make("nvvidconv", "nvvidconv");
app->encode = gst_element_factory_make("nvv4l2h264enc", "nvv4l2h264enc");
app->pay = gst_element_factory_make("rtph264pay", "rtph264pay");
app->udpsink = gst_element_factory_make("udpsink", "udpsink");
assert(app->src);
assert(app->convert);
assert(app->encode);
assert(app->pay);
assert(app->udpsink);
cerr << "yay!\n";
g_object_set (G_OBJECT (app->src),
"caps", gst_caps_new_simple ("video/x-raw",
"format", G_TYPE_STRING, "RGB",
"width", G_TYPE_INT, WIDTH,
"height", G_TYPE_INT, HEIGHT,
"framerate", GST_TYPE_FRACTION, 0, 1,
nullptr),
"stream-type", 0, // GST_APP_STREAM_TYPE_STREAM
"format", GST_FORMAT_TIME,
"is-live", TRUE,
nullptr);
cerr << "appsrc config done\n";
g_object_set(G_OBJECT(app->pay),
"name", G_TYPE_STRING, "pay0",
"pt", G_TYPE_INT, 96,
nullptr);
cerr << "payload config done \n";
g_object_set(G_OBJECT(app->udpsink),
"port", G_TYPE_INT, 5000,
"host", "192.168.1.176",
nullptr);
cerr << "udpsink config done\n";
cerr << "config done\n";
}
When the program runs with GST_DEBUG=4 this is the output:
0:00:00.000113961 18425 0x55b3cd0a00 INFO GST_INIT gst.c:586:init_pre: Initializing GStreamer Core Library version 1.14.5
0:00:00.000185213 18425 0x55b3cd0a00 INFO GST_INIT gst.c:587:init_pre: Using library installed in /usr/lib/aarch64-linux-gnu
0:00:00.000223131 18425 0x55b3cd0a00 INFO GST_INIT gst.c:607:init_pre: Linux desktop 4.9.201-tegra #1 SMP PREEMPT Wed May 5 09:31:36 PDT 2021 aarch64
0:00:00.000697935 18425 0x55b3cd0a00 INFO GST_INIT gstmessage.c:127:_priv_gst_message_initialize: init messages
0:00:00.001790879 18425 0x55b3cd0a00 INFO GST_INIT gstcontext.c:84:_priv_gst_context_initialize: init contexts
0:00:00.002225422 18425 0x55b3cd0a00 INFO GST_PLUGIN_LOADING gstplugin.c:317:_priv_gst_plugin_initialize: registering 0 static plugins
0:00:00.002460844 18425 0x55b3cd0a00 INFO GST_PLUGIN_LOADING gstplugin.c:225:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.002497512 18425 0x55b3cd0a00 INFO GST_PLUGIN_LOADING gstplugin.c:227:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.002545690 18425 0x55b3cd0a00 INFO GST_REGISTRY gstregistry.c:1727:ensure_current_registry: reading registry cache: ~/.cache/gstreamer-1.0/registry.aarch64.bin
0:00:00.041980864 18425 0x55b3cd0a00 INFO GST_REGISTRY gstregistrybinary.c:621:priv_gst_registry_binary_read_cache: loaded ~/.cache/gstreamer-1.0/registry.aarch64.bin in 0.039374 seconds
0:00:00.042121337 18425 0x55b3cd0a00 INFO GST_REGISTRY gstregistry.c:1583:scan_and_update_registry: Validating plugins from registry cache: ~/.cache/gstreamer-1.0/registry.aarch64.bin
0:00:00.047360846 18425 0x55b3cd0a00 INFO GST_REGISTRY gstregistry.c:1685:scan_and_update_registry: Registry cache has not changed
0:00:00.047399336 18425 0x55b3cd0a00 INFO GST_REGISTRY gstregistry.c:1762:ensure_current_registry: registry reading and updating done, result = 1
0:00:00.047422514 18425 0x55b3cd0a00 INFO GST_INIT gst.c:807:init_post: GLib runtime version: 2.56.4
0:00:00.047444442 18425 0x55b3cd0a00 INFO GST_INIT gst.c:809:init_post: GLib headers version: 2.56.4
0:00:00.047461004 18425 0x55b3cd0a00 INFO GST_INIT gst.c:810:init_post: initialized GStreamer successfully
0:00:00.047973778 18425 0x55b3cd0a00 INFO GST_PLUGIN_LOADING gstplugin.c:901:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstapp.so" loaded
0:00:00.048009560 18425 0x55b3cd0a00 INFO GST_ELEMENT_FACTORY gstelementfactory.c:359:gst_element_factory_create: creating element "appsrc" named "appsrc"
0:00:00.048414571 18425 0x55b3cd0a00 INFO GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstBaseSrc@0x55b3f101d0> adding pad 'src'
0:00:00.079080146 18425 0x55b3cd0a00 INFO GST_PLUGIN_LOADING gstplugin.c:901:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvidconv.so" loaded
0:00:00.079136814 18425 0x55b3cd0a00 INFO GST_ELEMENT_FACTORY gstelementfactory.c:359:gst_element_factory_create: creating element "nvvidconv" named "nvvidconv"
0:00:00.079500573 18425 0x55b3cd0a00 INFO GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstBaseTransform@0x55b3d99cd0> adding pad 'sink'
0:00:00.079556512 18425 0x55b3cd0a00 INFO GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstBaseTransform@0x55b3d99cd0> adding pad 'src'
0:00:00.082245747 18425 0x55b3cd0a00 INFO GST_PLUGIN_LOADING gstplugin.c:901:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideo4linux2.so" loaded
0:00:00.082293822 18425 0x55b3cd0a00 INFO GST_ELEMENT_FACTORY gstelementfactory.c:359:gst_element_factory_create: creating element "nvv4l2h264enc" named "nvv4l2h264enc"
0:00:00.082677477 18425 0x55b3cd0a00 INFO GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstVideoEncoder@0x55b3f5a4f0> adding pad 'sink'
0:00:00.082773209 18425 0x55b3cd0a00 INFO GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstVideoEncoder@0x55b3f5a4f0> adding pad 'src'
0:00:00.086190692 18425 0x55b3cd0a00 INFO GST_PLUGIN_LOADING gstplugin.c:901:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstrtp.so" loaded
0:00:00.086241370 18425 0x55b3cd0a00 INFO GST_ELEMENT_FACTORY gstelementfactory.c:359:gst_element_factory_create: creating element "rtph264pay" named "rtph264pay"
0:00:00.086497106 18425 0x55b3cd0a00 INFO GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstRTPBasePayload@0x55b3f6a1c0> adding pad 'src'
0:00:00.086546430 18425 0x55b3cd0a00 INFO GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstRTPBasePayload@0x55b3f6a1c0> adding pad 'sink'
0:00:00.090331266 18425 0x55b3cd0a00 INFO GST_PLUGIN_LOADING gstplugin.c:901:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstudp.so" loaded
0:00:00.090377049 18425 0x55b3cd0a00 INFO GST_ELEMENT_FACTORY gstelementfactory.c:359:gst_element_factory_create: creating element "udpsink" named "udpsink"
0:00:00.090915500 18425 0x55b3cd0a00 INFO GST_ELEMENT_PADS gstelement.c:670:gst_element_add_pad:<GstBaseSink@0x55b3f74a00> adding pad 'sink'
yay!
appsrc config done
Segmentation fault (core dumped)