how to retransmit using pipeline as udpsrc+rtpbin+udpsink
111
arthurhi at 126.com
Thu Mar 20 20:13:36 PDT 2014
i am creating a simple pipeline like this udpsrc+rtpbin+udpsink, but it will not work when i connect "pad-added" of rtpbin.
i can see some examples using command line to build a pipeline. but now i want to write some code to implement.
can you help me ?thanks a lot.
after seeing client-PCMA.c i write code as follows:
gint
main (int argc, char *argv[])
{
GstElement *pipeline;
GstElement *udprecv1;
GstElement *rtpbin1;
//GstElement *multiudpsend1;
GstElement *udpsend1;
GstPad *srcpad, *sinkpad;
GstPadLinkReturn lres;
GMainLoop *loop;
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
pipeline = gst_pipeline_new ("test_transmit");
udprecv1 = gst_element_factory_make ("udpsrc", "udpsrc1");
rtpbin1 = gst_element_factory_make ("rtpbin", "rtpbin1");
udpsend1 = gst_element_factory_make ("udpsink", "udpsend1");
if (!pipeline || !udprecv1 || !rtpbin1 || !udpsend1) {
g_print ("One element could not be created. Exiting.\n");
return 1;
}
g_object_set (udprecv1, "port", 20000, NULL);
g_object_set (udpsend1, "port", 10000, "host", "192.168.6.63", NULL);
g_object_set (rtpbin1, "do-retransmission", 1, NULL);
gst_bin_add_many (GST_BIN (pipeline),
udprecv1, rtpbin1, udpsend1, NULL);
srcpad = gst_element_get_static_pad (udprecv1, "src");
sinkpad = gst_element_get_request_pad (rtpbin1, "recv_rtp_sink_0");
lres = gst_pad_link (srcpad, sinkpad);
g_assert (lres == GST_PAD_LINK_OK);
gst_object_unref (srcpad);
/* the RTP pad that we have to connect to the depayloader will be created
* dynamically so we connect to the pad-added signal, pass the depayloader as
* user_data so that we can link to it. */
g_signal_connect (rtpbin1, "pad-added", G_CALLBACK (pad_added_cb1), udpsend1);
/* Set the pipeline to "playing" state*/
g_print ("Now playing: %s\n", argv[1]);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Iterate */
g_print ("Running...\n");
g_main_loop_run (loop);
/* Out of the main loop, clean up nicely */
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));
g_main_loop_unref (loop);
return 0;
}
i have not seen pad_added_cb1 being called back.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140321/e0fd678e/attachment-0001.html>
More information about the gstreamer-devel
mailing list