rtspsrc to udpsink, Command line pipeline works, C++ application doesn't NEED HELP URGENTLY

debruyn debruynels1 at gmail.com
Wed Feb 17 06:04:18 UTC 2016


Good day plz help
I am busy developinga streaming framework and i have a board that takes a
rtsp stream  and sends it to a udpsink. First of all the pipeline for the
server listening( This works in commandline and my C++ application):udpsrc !
rtpjitterbuffer ! rtph264depay ! avdec_h264 ! theoraenc ! oggmux !
shout2sendNow the pipeline that sends the stream to th udpsocket looks like
follows:gst-launch-1.0 rtspsrc location=rtsp://10.15.1.15/video.h264
user-id=id user-pw=pw latency=0 ! udpsink host=ipaddr port=5555This pipeline
works fine and sends the stream to the UDP port. I can see the pipeline on
the server change from paused to playing as soon as i send the stream to the
socket. (Works for both my server pipeline and application)Now the part that
doesn't make sense, This doesn't work on my C++ application for the board
that sends the stream. The application on the board goes all the way to the
playing state but the pipeline/application on the server just stays in the
paused state. It is like it never notices that the the stream was sent to
the UDP port. Below is my code for the application on the board:/#include
<gst/gst.h>#include #include typedef struct _CustomData {	GstElement
*pipeline;	GstElement *source;	GstElement *sink;	GMainLoop *main_loop;
GstBus *bus;}	CustomData;/* Handler for the pad-added signal, bus messages
,keyboard input and probes*/static void pad_added_handler(GstElement *src,
GstPad *pad, CustomData *data);static gboolean handle_message(GstBus *bus,
GstMessage *msg, CustomData *data);int main(int argc, char *argv[])
{/*Variable Declaration*/	CustomData data;	guint bus_watch_id;
GstStateChangeReturn state_returned;/*Initialize GStreamer*/	gst_init(&argc,
&argv);/*Create the elements for the pipe*/	data.source =
gst_element_factory_make("rtspsrc", "source");	data.sink =
gst_element_factory_make("udpsink", "sink");/*Create the storage pipeline*/
data.pipeline = gst_pipeline_new("stream-pipeline");	if(!data.pipeline ||
!data.source || !data.sink){		g_printerr("Not all elements could be
created.\n");    return -1;	}/*Build the pipeline*/
gst_bin_add_many(GST_BIN(data.pipeline), data.source, data.sink, NULL);/*Set
the source elements' properties*/
g_object_set(data.source,"location","rtsp://10.15.1.15/h264/ch1/main/av_stream","user-id","admin","user-pw","admin123","name","source","latency","500",NULL);/*Set
the sink elements' properties*/
g_object_set(data.sink,"clients","10.15.1.182:5555",NULL);/*Link pads betwen
rtspsrc and rtpjitterbuffer*/	g_signal_connect(data.source, "pad-added",
G_CALLBACK(pad_added_handler),&data);/* Add a bus watch, so we get notified
when a message arrives */  data.bus = gst_element_get_bus (data.pipeline); 
bus_watch_id = gst_bus_add_watch (data.bus, (GstBusFunc)handle_message,
&data);/*Start playing the pipe*/	state_returned =
gst_element_set_state(data.pipeline, GST_STATE_PLAYING);  if (state_returned
== GST_STATE_CHANGE_FAILURE) {    g_printerr ("Unable to set the pipeline to
the playing state.\n");    gst_object_unref (data.pipeline);    return -1; 
}/*Create a GLib Main Loop and set it to run*/	data.main_loop =
g_main_loop_new(NULL, FALSE);	g_main_loop_run(data.main_loop);/* Free
resources */	gst_object_unref (data.bus);  gst_element_set_state
(data.pipeline, GST_STATE_NULL);  gst_object_unref (data.pipeline);
g_main_loop_unref(data.main_loop);  return 0;}/* This function will be
called by the pad-added signal */static void pad_added_handler (GstElement
*src, GstPad *new_pad, CustomData *data) {	GstElement *link_element =
GST_ELEMENT(data->sink);	GstPad *sink_pad;	sink_pad =
gst_element_get_static_pad (link_element, "sink");	gst_pad_link (new_pad,
sink_pad);  gst_object_unref (sink_pad);}/*Process messages from
GStreamer*/static gboolean handle_message(GstBus *bus, GstMessage *msg,
CustomData *data){	GError *err;	gchar *debug_info;	switch (GST_MESSAGE_TYPE
(msg)) {		case GST_MESSAGE_ERROR:			gst_message_parse_error (msg, &err,
&debug_info);			g_printerr ("Error received from element %s: %s\n",
GST_OBJECT_NAME (msg->src), err->message);			g_printerr ("Debugging
information: %s\n", debug_info ? debug_info : "none");			g_clear_error
(&err);			g_free (debug_info);			g_main_loop_quit(data->main_loop);			break;	
case GST_MESSAGE_EOS:			g_print ("EOS received on OBJ NAME
%s\n",GST_OBJECT_NAME(msg->src));			g_main_loop_quit(data->main_loop);		
break;		case GST_MESSAGE_STATE_CHANGED:		/*State-changed messages from the
pipeline*/			if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->pipeline)) {			
GstState old_state, new_state, pending_state;			
gst_message_parse_state_changed (msg, &old_state, &new_state,
&pending_state);				g_print ("Pipeline state changed from %s to %s:\n",					
gst_element_state_get_name (old_state), gst_element_state_get_name
(new_state));			}			break;		default:			break;	}/*Keep receiving messages*/ 
return TRUE;}/



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/rtspsrc-to-udpsink-Command-line-pipeline-works-C-application-doesn-t-NEED-HELP-URGENTLY-tp4675894.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160216/b2aacf85/attachment-0001.html>


More information about the gstreamer-devel mailing list