i did it, the pad never is created :-(, but i get no message of warning or error neither. And on the list of signals of the gstrtpbin there is no "pad-added" signal, its normal to the signal dont be there?<br><b><br>
<span style="font-family: verdana,sans-serif;">g_signal_connect (rtp_bin, "pad-added", G_CALLBACK (on_pad_added), rtp_decoder);</span></b><br><br><div class="gmail_quote">On Sat, May 9, 2009 at 3:55 AM, Aurelien Grimaud <span dir="ltr"><<a href="mailto:gstelzz@yahoo.fr">gstelzz@yahoo.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You should add the pad-added signal on the rtpbin.<br>
When it triggers, check the pad name to find out which pad it is.<br>
If pad is a recv_rtp_src_%d_%d_%d, link your decoder and sink in the<br>
call back.<br>
<br>
Aurelien<br>
<br>
Tiago Katcipis a écrit :<br>
<div class="im">> Im trying to do a rtp stream sending data and another side receiving<br>
> the data, the part that sends the data is working fine, but the part<br>
> that receives is giving me a lot of trouble. At<br>
> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-gstrtpbin.html" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-gstrtpbin.html</a><br>
> i have read:<br>
><br>
> "To use GstRtpBin<br>
</div>> <<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-gstrtpbin.html#GstRtpBin" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-gstrtpbin.html#GstRtpBin</a>><br>
<div class="im">> as an RTP receiver, request a recv_rtp_sink_%|d| pad. The session<br>
> number must be specified in the pad name. Data received on the<br>
> recv_rtp_sink_%|d| pad will be processed in the gstrtpsession manager<br>
> and after being validated forwarded on GstRtpsSrcDemux element. Each<br>
> RTP stream is demuxed based on the SSRC and send to a<br>
> GstRtpJitterBuffer<br>
</div>> <<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-gstrtpjitterbuffer.html#GstRtpJitterBuffer" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-gstrtpjitterbuffer.html#GstRtpJitterBuffer</a>>.<br>
<div><div></div><div class="h5">> After the packets are released from the jitterbuffer, they will be<br>
> forwarded to a GstRtpsSrcDemux element. The GstRtpsSrcDemux element<br>
> will demux the packets based on the payload type and will create a<br>
> unique pad recv_rtp_src_%|d_|%|d_|%|d| on gstrtpbin with the session<br>
> number, SSRC and payload type respectively as the pad name. "<br>
><br>
> on my application i cant get the recv_rtp_src_%|d_|%|d_|%|d, |i<br>
> already tried on a lot of ways, my last shot was try to iterate over<br>
> all the pads on the bin and try to conect, i discovered that the src<br>
> pad never shows up. No error is given. I can get the on-new-ssrc<br>
> signal...and other signals as |on-ssrc-validated... but on all this<br>
> signals the | recv_rtp_src_%|d_|%|d_|%|d is not created yet, i also<br>
> tried to get the "on-pad-added" signal but this signal never happens|.<br>
><br>
> My problem is, when the recv_rtp_src_%|d_|%|d_|%|d is created|. When i<br>
> iterate over the pads i always get a<br>
> ** (teste_rtp:9516): DEBUG: GstRtpBin has [0] src pads<br>
><br>
> here goes the source code, is a little messy because im all day trying<br>
> a lot of different ways to do this. And i get no error message.<br>
><br>
> #include <gst/gst.h><br>
> #include <glib.h><br>
><br>
> #define PORTA_UDP_ENTRADA 5000<br>
><br>
> static gboolean<br>
> bus_call (GstBus *bus,<br>
> GstMessage *msg,<br>
> gpointer data)<br>
> {<br>
> GMainLoop *loop = (GMainLoop *) data;<br>
><br>
> switch (GST_MESSAGE_TYPE (msg)) {<br>
><br>
> case GST_MESSAGE_EOS:<br>
> g_print ("End of stream\n");<br>
> g_main_loop_quit (loop);<br>
> break;<br>
><br>
> case GST_MESSAGE_ERROR: {<br>
> gchar *debug;<br>
> GError *error;<br>
><br>
> gst_message_parse_error (msg, &error, &debug);<br>
> g_free (debug);<br>
><br>
> g_printerr ("Error: %s\n", error->message);<br>
> g_error_free (error);<br>
><br>
> g_main_loop_quit (loop);<br>
> break;<br>
> }<br>
> default:<br>
> g_print("Tipo da mensagem [%d], Nome da mensagem [%s]\n",<br>
> GST_MESSAGE_TYPE (msg), GST_MESSAGE_TYPE_NAME(msg));<br>
> break;<br>
> }<br>
><br>
> return TRUE;<br>
> }<br>
><br>
><br>
> static void<br>
> on_new_ssrc (GstElement* gstrtpbin,<br>
> guint session,<br>
> guint ssrc,<br>
> gpointer data)<br>
> {<br>
> GstPad* sinkpad;<br>
> GstPad* srcpad[1];<br>
> GstElement* decoder = (GstElement *) data;<br>
> GstIterator* iter;<br>
> gint done, linked, iter_count;<br>
><br>
> g_print ("New session stabilished, linking gstrtpbin session src pad<br>
> to the rtp_decoder\n");<br>
><br>
> sinkpad = gst_element_get_static_pad(decoder, "sink");<br>
> // TODO Esta dificil de pegar o pad src do gstrtpbin que eh criado<br>
> ao iniciar uma sessao nova.<br>
> if(!sinkpad){<br>
> g_warning("Error getting rtp_decoder sink pad");<br>
> return;<br>
> }<br>
> /*<br>
> unique pad recv_rtp_src_%d_%d_%d on gstrtpbin with the session<br>
> number, SSRC and payload type respectively as the pad name.<br>
><br>
> <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-gstrtpbin.html" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/gst-plugins-bad-plugins-gstrtpbin.html</a><br>
> */<br>
><br>
> iter = gst_element_iterate_src_pads(gstrtpbin);<br>
> if(!iter){<br>
> g_warning("Error getting gstrtpbin pads iterator");<br>
> return;<br>
> }<br>
><br>
> done = FALSE;<br>
> linked = FALSE;<br>
> iter_count = 0;<br>
><br>
> while (!done) {<br>
> switch (gst_iterator_next (iter, (gpointer *) srcpad)) {<br>
> case GST_ITERATOR_OK:<br>
> if(gst_pad_link (*srcpad, sinkpad) != GST_PAD_LINK_OK){<br>
> g_warning("Error linking gstrtpbin pad[%s] to<br>
> rtp_decoder pad[%s]", gst_pad_get_name(*srcpad),<br>
> gst_pad_get_name(sinkpad));<br>
> }else{<br>
> g_warning("Linked gstrtpbin pad[%s] to rtp_decoder<br>
> pad[%s] with success", gst_pad_get_name(*srcpad),<br>
> gst_pad_get_name(sinkpad));<br>
> linked = TRUE;<br>
> }<br>
> iter_count++;<br>
> gst_object_unref (*srcpad);<br>
> break;<br>
> case GST_ITERATOR_RESYNC:<br>
> gst_iterator_resync (iter);<br>
> break;<br>
> case GST_ITERATOR_ERROR:<br>
> done = TRUE;<br>
> break;<br>
> case GST_ITERATOR_DONE:<br>
> done = TRUE;<br>
> break;<br>
> }<br>
> }<br>
> if(!linked){<br>
> g_warning("failed to found a valid recv_src_pad on gstrtpbin");<br>
> }<br>
> g_debug("GstRtpBin has [%d] src pads", iter_count);<br>
><br>
> gst_iterator_free (iter);<br>
> gst_object_unref (sinkpad);<br>
> }<br>
><br>
> static void<br>
> on_pad_added (GstElement *element,<br>
> GstPad *pad,<br>
> gpointer data)<br>
> {<br>
> GstPad *sinkpad;<br>
> GstElement *decoder = (GstElement *) data;<br>
><br>
> /* We can now link this pad with the converter sink pad */<br>
> g_print ("Dynamic pad created, linking wavparser/converter\n");<br>
><br>
> sinkpad = gst_element_get_static_pad (decoder, "sink");<br>
> if(gst_pad_link (pad, sinkpad) != GST_PAD_LINK_OK){<br>
> g_warning("Error linking recv_rtp_src pad to sinkpad");<br>
> }<br>
> gst_object_unref (sinkpad);<br>
> }<br>
><br>
> int<br>
> main (int argc,<br>
> char *argv[])<br>
> {<br>
> GMainLoop *loop;<br>
><br>
> GstElement *pipeline, *source, *rtp_bin, *rtp_decoder, *sink;<br>
> GstPad *gstrtp_sink_pad;<br>
> GstBus *bus;<br>
><br>
> /* Initialisation */<br>
> gst_init (&argc, &argv);<br>
><br>
> loop = g_main_loop_new (NULL, FALSE);<br>
><br>
> /* Create gstreamer elements */<br>
> pipeline = gst_pipeline_new ("audio-player");<br>
> source = gst_element_factory_make ("udpsrc","udp-source");<br>
> rtp_bin = gst_element_factory_make ("gstrtpbin", "gst_rtpbin");<br>
> rtp_decoder = gst_element_factory_make ("rtpL16depay", "rtp_decoder");<br>
> sink = gst_element_factory_make ("filesink", "file-sink");<br>
><br>
> if (!pipeline || !source || !sink || !rtp_decoder || !rtp_bin) {<br>
> g_printerr ("One element could not be created. Exiting.\n");<br>
> return -1;<br>
> }<br>
><br>
> gstrtp_sink_pad = gst_element_get_request_pad(rtp_bin,<br>
> "recv_rtp_sink_0");<br>
> if (!gstrtp_sink_pad) {<br>
> g_printerr ("Sink pad could not be created. Exiting.\n");<br>
> return -1;<br>
> }<br>
><br>
> /* Set up the pipeline */<br>
> g_object_set (G_OBJECT (source), "port", PORTA_UDP_ENTRADA , NULL);<br>
> g_object_set (G_OBJECT (sink), "location", "dados_recebidos_rtp" ,<br>
> NULL);<br>
><br>
> /* we add a message handler */<br>
> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>
> gst_bus_add_watch (bus, bus_call, loop);<br>
> gst_object_unref (bus);<br>
><br>
> /* we add all elements into the pipeline */<br>
> /* file-source | ogg-demuxer | vorbis-decoder | converter |<br>
> alsa-output */<br>
> gst_bin_add_many (GST_BIN (pipeline),<br>
> source, sink, rtp_bin, rtp_decoder, NULL);<br>
><br>
> /* we link the elements together */<br>
> if(gst_pad_link(gst_element_get_static_pad(source, "src"),<br>
> gstrtp_sink_pad) != GST_PAD_LINK_OK){<br>
> g_warning("Error linking source to the gstrtp_sink_pad");<br>
> gst_object_unref (GST_OBJECT (pipeline));<br>
> return 0;<br>
> }<br>
><br>
> /*<br>
> After the packets are released from the jitterbuffer, they will be<br>
> forwarded to a GstRtpsSrcDemux element.<br>
> The GstRtpsSrcDemux element will demux the packets based on the<br>
> payload type and will create a unique pad<br>
> recv_rtp_src_%d_%d_%d on gstrtpbin with the session number, SSRC<br>
> and payload type respectively as the pad name.<br>
> Because of that we have to dinamicaly link the src pads on runtime.<br>
> */<br>
> g_signal_connect (rtp_bin, "pad-added", G_CALLBACK (on_pad_added),<br>
> rtp_decoder);<br>
> g_signal_connect (rtp_bin, "on-new-ssrc", G_CALLBACK (on_new_ssrc),<br>
> rtp_decoder);<br>
><br>
> if(!gst_element_link (rtp_decoder, sink)){<br>
> g_warning("Error linking the rtp_decoder to the sink");<br>
> gst_object_unref (GST_OBJECT (pipeline));<br>
> return -1;<br>
> }<br>
><br>
> /* Set the pipeline to "playing" state*/<br>
> g_print ("listening on port: %d\n", PORTA_UDP_ENTRADA);<br>
> gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>
><br>
> /* Iterate */<br>
> g_print ("Running...\n");<br>
> g_main_loop_run (loop);<br>
><br>
> /* Out of the main loop, clean up nicely */<br>
> g_print ("Returned, stopping listening on port\n");<br>
> gst_element_set_state (pipeline, GST_STATE_NULL);<br>
><br>
> g_print ("Deleting pipeline\n");<br>
> gst_object_unref (GST_OBJECT (pipeline));<br>
><br>
> return 0;<br>
> }<br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
><br>
> ------------------------------------------------------------------------------<br>
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your<br>
> production scanning environment may not be a perfect world - but thanks to<br>
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700<br>
> Series Scanner you'll get full speed at 300 dpi even with all image<br>
> processing features enabled. <a href="http://p.sf.net/sfu/kodak-com" target="_blank">http://p.sf.net/sfu/kodak-com</a><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
><br>
<br>
<br>
------------------------------------------------------------------------------<br>
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your<br>
production scanning environment may not be a perfect world - but thanks to<br>
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700<br>
Series Scanner you'll get full speed at 300 dpi even with all image<br>
processing features enabled. <a href="http://p.sf.net/sfu/kodak-com" target="_blank">http://p.sf.net/sfu/kodak-com</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>"it might be a profitable thing to learn Java, but it has no intellectual value whatsoever" Alexander Stepanov<br>