I'm trying to test udp streaming on localhost but it's not showing anything:
videotestsrc (or audiotestsrc) -> udpsink (port: 5078, host: 127.0.0.1)
Here is the code:
console_out_inf("TESTING", "Starting work with test elements");
gint port = 5078;
// TEST PIPELINE OUT
gst_bin_add_many(GST_BIN(GSD->pipetest_out), GSD->testsrc, GSD->udpsink, NULL);
gchar* host = "127.0.0.1";
g_object_set(GSD->udpsink, "port", port, NULL);
g_object_set(GSD->udpsink, "host", host, NULL);
if (!gst_element_link(GSD->testsrc, GSD->udpsink))
console_out_bad("STREAMING", "Error linking test udp elements -- SEND");
else
console_out_yes("STREAMING", "Correctly linked test udp elements -- SEND");
// TEST PIPELINE IN
gst_bin_add_many(GST_BIN(GSD->pipetest_in), GSD->udpsrc, GSD->autovideosink, NULL);
gst_element_set_state(GSD->udpsrc, GST_STATE_NULL);
g_object_set(GSD->udpsrc, "port", port, NULL);
if (!gst_element_link(GSD->udpsrc, GSD->autovideosink))
console_out_bad("STREAMING", "Error linking test udp elements -- RECEIVE");
else
console_out_yes("STREAMING", "Correctly linked test udp elements -- RECEIVE");
// PLAY TEST PIPELINE OUT
GstStateChangeReturn ret1;
ret1 = gst_element_set_state(GSD->pipetest_out, GST_STATE_PLAYING);
if (ret1 == GST_STATE_CHANGE_FAILURE)
console_out_bad("TESTING", "Failed playing pipetest out");
else
console_out_yes("TESTING", "Correctly played pipetest out");
// PLAY TEST PIPELINE IN
GstStateChangeReturn ret2;
ret2 = gst_element_set_state(GSD->pipetest_in, GST_STATE_PLAYING);
if (ret2 == GST_STATE_CHANGE_FAILURE)
console_out_bad("TESTING", "Failed playing pipetest in");
else
console_out_yes("TESTING", "Correctly played pipetest in");
// PRINT PIPELINES
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(GSD->pipetest_out), GST_DEBUG_GRAPH_SHOW_ALL, "pipetest_out");
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(GSD->pipetest_in), GST_DEBUG_GRAPH_SHOW_ALL, "pipetest_in");
This is "my own console output":
EDIT : not relevant anymore! Everything is instanciated fine, the pipeline was built correctly, yet with
PIPELINE OUT : videotestsrc --> udpsink (host:127.0.0.1, port: 5078)
PIPELINE IN : udpsrc (port: 5078) --> autovideosink
The autovideosink does not display anything! By checking netstat -a, no connection on such port is showed.
Additional INFO:
Does anyone know what am I doing wrong?
This code seems fine but it doesn't relate to the console output you posted.
Try testing your pipeline piece by piece with the command line gst-launch:
gst-launch-1.0 -e -v videotestsrc ! udpsink host="127.0.01"
connected to a fakesink first and then swapping in the udp sink, once you have it working in the command line mirror the command in code.
try it with host="localhost" or host="192.168.0.1" i can't remember but i think udpsink might have trouble sending to the loopback
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.