video not displayed with the use of rtp
gagankumarnigam
gagankumarnigam at bel.co.in
Sat Jun 20 03:06:14 PDT 2015
Hi all,
i have taken demo-send.cpp(from net which is given below) example compiled
and run on one system .It is Running successfully without any error and also
showing display.
however on client i gave cmd line argument which is running well but not
given any display: It is like that
[arcgis at localhost Desktop]$ gst-launch -v udpsrc port=8999
caps="application/x-rtp,payload=96,encoding-name=H264" ! rtph264depay !
h264parse ! ffdec_h264 ! autovideosink
and o/p is
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
but no display..................
Can any one suggest me what is the errrrrrrrrrrrrrrrrrrrrrrrrrrr here??
Server side code is given below
************demo.server.cpp*******************
#include<gst/gst.h>
#define RECV_IP "192.168.1.3"
static gboolean
bus_call( GstBus *bus,GstMessage *msg, gpointer data )
{
GMainLoop *loop = ( GMainLoop* )data;
switch( GST_MESSAGE_TYPE( msg )) {
case GST_MESSAGE_EOS:
g_print ( "End-of-stream\n" );
g_main_loop_quit( loop );
break;
case GST_MESSAGE_ERROR: {
gchar *debug;
GError* err;
gst_message_parse_error( msg,&err,&debug );
g_print ( "Error: %s\n", err ->message );
g_error_free( err );
g_main_loop_quit ( loop );
break;
}
default:
break;
}
return TRUE;
}
int main(int argc, char* argv[])
{
GstElement *pipeline, *source,*queue,*videoscale,*capsfilter;
GstElement *ffmpegcs, *encoder, *rtph264pay;
GstElement *rtpbin, *udpsink_rtp, *udpsink_rtcp,*udpsrc_rtcp;
GstElement *sink, *tee, *queuesave,*queuesend;
GstElement *filesink;
GstElement *ffmpegcsd;
GMainLoop *loop;
gboolean ret = FALSE;
int port = 4030;
GstCaps* caps;
gchar* name;
GstPad* sinkpad;
GstCaps* sinkcaps;
gint* port2;
//GstStaticCaps staticcaps;
gst_init (&argc, &argv);
caps = gst_caps_from_string( "video/x-raw-yuv,width=320,height=240" );//
GST_STATIC_CAPS( "video/x-raw-yuv,width=320,height=240" );
//staticcaps = GST_STATIC_CAPS( "video/x-raw-yuv,width=320,height=240" );//
GST_STATIC_CAPS( "video/x-raw-yuv,width=320,height=240" );
loop = g_main_loop_new( NULL,FALSE );
pipeline = gst_pipeline_new( "video-send" );
source = gst_element_factory_make ( "v4l2src","file-source" );
queue = gst_element_factory_make ( "queue", "queue" );
videoscale = gst_element_factory_make ( "videoscale", "videoscale" );
capsfilter = gst_element_factory_make ( "capsfilter", "capsfilter" );
ffmpegcs = gst_element_factory_make ( "ffmpegcolorspace", "ffmpegcs"
);
ffmpegcsd = gst_element_factory_make ( "ffmpegcolorspace", "ffmpegcsd"
);
encoder = gst_element_factory_make ( "x264enc", "encoder" );
rtph264pay = gst_element_factory_make ( "rtph264pay", "rtph264pay" );
rtpbin = gst_element_factory_make ( "gstrtpbin", "rtpbin" );
udpsink_rtp = gst_element_factory_make ( "udpsink", "udpsink-send data"
);
udpsink_rtcp = gst_element_factory_make ( "udpsink", "udpsink-rtcp" );
udpsrc_rtcp = gst_element_factory_make ( "udpsrc", "udpsrc-rtcp" );
sink = gst_element_factory_make ( "autovideosink", "sink" );
filesink = gst_element_factory_make ( "filesink", "filesink" );
tee = gst_element_factory_make ( "tee", "tee" );
queuesave = gst_element_factory_make ( "queue", "queuesave" );
queuesend = gst_element_factory_make ( "queue", "queuesend" );
if( !pipeline || !source || !queue || !videoscale || !capsfilter ||
!ffmpegcs || !encoder || !rtph264pay || !rtpbin ||
!udpsink_rtp || !udpsink_rtcp || !udpsrc_rtcp || !ffmpegcsd ) {
g_print ( "One element could not be created \n" );
return -1;
}
g_object_set( G_OBJECT ( filesink ), "location", "./test.txt", NULL );
g_object_set( G_OBJECT ( capsfilter ), "caps", caps, NULL );
g_object_set( G_OBJECT ( encoder ), "bitrate", 100000, NULL);
g_object_set( G_OBJECT ( udpsink_rtp ), "host", RECV_IP, NULL );
g_object_set( G_OBJECT ( udpsink_rtp ), "port", 10000, NULL );
g_object_set( G_OBJECT ( udpsink_rtcp ),"host", RECV_IP, NULL );
g_object_set( G_OBJECT ( udpsink_rtcp ), "port", 10001, NULL );
g_object_set( G_OBJECT ( udpsrc_rtcp ), "port", 10002, NULL );
//gst_bus_add_watch( gst_pipeline_get_bus( GST_PIPELINE( pl_send ) ),
//bus_call,loop );
#if 0
gst_bin_add_many( GST_BIN( pipeline ), source, queue, videoscale,
capsfilter,
ffmpegcs, queuesave,queuesend, tee, filesink, sink, NULL);
ret = gst_element_link_many( source, capsfilter, ffmpegcs,queue, tee, NULL
);
ret = gst_element_link_many( tee, queuesend, sink, NULL );
ret = gst_element_link_many( tee, queuesave, filesink, NULL );
//ret = gst_element_link_many( source, queue, filesink, NULL );
/*gst_bin_add_many( GST_BIN( pipeline ), source, queue, videoscale,
capsfilter,
ffmpegcs, encoder, rtph264pay, udpsink_rtp, udpsink_rtcp, udpsrc_rtcp,
rtpbin, NULL);
ret = gst_element_link_many( source, queue, videoscale, capsfilter,
ffmpegcs, encoder, udpsink_rtp, NULL );*/
#else
gst_bin_add_many( GST_BIN( pipeline ), source,ffmpegcs, capsfilter, queue,
tee,
encoder,queuesend,rtph264pay, rtpbin,udpsink_rtp, udpsink_rtcp,
udpsrc_rtcp,
queuesave, ffmpegcsd, sink, NULL);
ret = gst_element_link_many( source, capsfilter,ffmpegcs, queue, tee, NULL
);
ret = gst_element_link_many( tee, queuesave,ffmpegcsd, sink, NULL );
ret = gst_element_link_many( tee, queuesend, encoder, rtph264pay, NULL );
ret = gst_element_link_pads_filtered( rtph264pay, "src", rtpbin,
"send_rtp_sink_0", NULL );
ret = gst_element_link_pads_filtered( rtpbin, "send_rtp_src_0",
udpsink_rtp, "sink", NULL );
ret = gst_element_link_pads_filtered( rtpbin, "send_rtcp_src_0",
udpsink_rtcp,"sink", NULL );
ret = gst_element_link_pads_filtered( udpsrc_rtcp, "src", rtpbin,
"recv_rtcp_sink_0", NULL );
#endif
g_print ( "Setting to sending data\n" );
gst_element_set_state ( pipeline, GST_STATE_PLAYING );
gst_element_set_locked_state( udpsink_rtcp, TRUE );
/*sinkpad = gst_element_get_pad( udpsink_rtp, "sink" );
sinkcaps = gst_caps_new_simple( NULL, NULL );
g_object_get( G_OBJECT ( udpsink_rtp ), "caps", sinkcaps, NULL );
sinkcaps = gst_pad_get_caps( sinkpad );
name = gst_caps_to_string( sinkcaps );*/
g_main_loop_run( loop );
g_print ( "returned ,stopping playback\n" );
gst_element_set_state( pipeline, GST_STATE_NULL );
g_print ( "Deleting pipeline\n" );
gst_object_unref( GST_OBJECT ( pipeline ) );
return 0;
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/video-not-displayed-with-the-use-of-rtp-tp4672364.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list